This commit is contained in:
jens 2022-12-24 02:27:35 +01:00
parent fff0a28310
commit 3d212456e6
2 changed files with 23 additions and 9 deletions

View File

@ -1276,7 +1276,7 @@ public class Actions
String str2 = "send." + String.valueOf(Math.abs(new Random().nextLong())) + ".dat"; String str2 = "send." + String.valueOf(Math.abs(new Random().nextLong())) + ".dat";
Uri contentUri = new Uri.Builder().authority(context.getPackageName() + ".MmsFileProvider").path(str2).scheme("content").build(); Uri contentUri = new Uri.Builder().authority(context.getPackageName() + ".MmsFileProvider").path(str2).scheme("content").build();
Bundle a3 = C3326a.m16196a(new C8792q("enableGroupMms", true), new C8792q("maxMessageSize", Integer.valueOf(C3664a.m17428d()))); // Bundle a3 = C3326a.m16196a(new C8792q("enableGroupMms", true), new C8792q("maxMessageSize", Integer.valueOf(C3664a.m17428d())));
SmsManager.getDefault().sendMultimediaMessage(context, contentUri, phoneNumber, null, null); SmsManager.getDefault().sendMultimediaMessage(context, contentUri, phoneNumber, null, null);
} }

View File

@ -296,13 +296,13 @@ public class Profile implements Comparable<Profile>
{ {
Miscellaneous.logEvent("i", "Profile", "Request to set ringtone to " + ringtoneFile.getAbsolutePath(), 3); Miscellaneous.logEvent("i", "Profile", "Request to set ringtone to " + ringtoneFile.getAbsolutePath(), 3);
if(!ringtoneFile.exists() || !ringtoneFile.canRead()) // if(!ringtoneFile.exists() || !ringtoneFile.canRead())
{ // {
String message = "Ringtone file does not exist or cannot read it: " + ringtoneFile.getAbsolutePath(); // String message = "Ringtone file does not exist or cannot read it: " + ringtoneFile.getAbsolutePath();
Miscellaneous.logEvent("i", "Profile", message, 3); // Miscellaneous.logEvent("i", "Profile", message, 3);
Toast.makeText(context, message, Toast.LENGTH_SHORT).show(); // Toast.makeText(context, message, Toast.LENGTH_SHORT).show();
return false; // return false;
} // }
ContentValues values = new ContentValues(); ContentValues values = new ContentValues();
values.put(MediaStore.MediaColumns.DATA, ringtoneFile.getAbsolutePath()); values.put(MediaStore.MediaColumns.DATA, ringtoneFile.getAbsolutePath());
@ -319,7 +319,7 @@ public class Profile implements Comparable<Profile>
Uri newRingTone = null; Uri newRingTone = null;
//TODO: This part needs to be made compatible with Android 11 and above. //TODO: This part needs to be made compatible with Android 11 and above.
if(Build.VERSION.SDK_INT > 30) if(Build.VERSION.SDK_INT < 30)
{ {
Uri existingRingTone = MediaStore.Audio.Media.getContentUriForPath(ringtoneFile.getAbsolutePath()); Uri existingRingTone = MediaStore.Audio.Media.getContentUriForPath(ringtoneFile.getAbsolutePath());
@ -329,6 +329,20 @@ public class Profile implements Comparable<Profile>
newRingTone = context.getContentResolver().insert(existingRingTone, values); newRingTone = context.getContentResolver().insert(existingRingTone, values);
} }
/*
Uri uri = MediaStore.Audio.Media.getContentUriForPath(newSoundFile.getAbsolutePath());
Uri newUri = mCr.insert(uri, values);
try {
Uri rUri = RingtoneManager.getValidRingtoneUri(this);
if (rUri != null)
ringtoneManager.setStopPreviousRingtone(true);
RingtoneManager.setActualDefaultRingtoneUri(getApplicationContext(), RingtoneManager.TYPE_RINGTONE, newUri);
Toast.makeText(this, "New Rigntone set", Toast.LENGTH_SHORT).show();
} catch (Throwable t) {
Log.e("sanjay in catch", "catch exception"+e.getMessage());
}
*/
RingtoneManager.setActualDefaultRingtoneUri(context, ringtoneType, newRingTone); RingtoneManager.setActualDefaultRingtoneUri(context, ringtoneType, newRingTone);
Miscellaneous.logEvent("i", "Profile", "Ringtone set to: " + newRingTone.toString(), 1); Miscellaneous.logEvent("i", "Profile", "Ringtone set to: " + newRingTone.toString(), 1);
return true; return true;