Secsoundpicker keeps crashing

Hi all,
Since upgrading to android 13 (or maybe even 11 or 12), my app keeps crashing when it tries to launch the ringtone picker.

The stacktrace is:

E/AndroidRuntime(10313): FATAL EXCEPTION: main
E/AndroidRuntime(10313): Process: com.samsung.android.secsoundpicker, PID: 10313
E/AndroidRuntime(10313): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.samsung.android.secsoundpicker/com.samsung.android.secsoundpicker.SecSoundPickerActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'int java.lang.Integer.intValue()' on a null object reference
E/AndroidRuntime(10313): 	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:4166)
E/AndroidRuntime(10313): 	at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:4312)
E/AndroidRuntime(10313): 	at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:101)
E/AndroidRuntime(10313): 	at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
E/AndroidRuntime(10313): 	at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
E/AndroidRuntime(10313): 	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2571)
E/AndroidRuntime(10313): 	at android.os.Handler.dispatchMessage(Handler.java:106)
E/AndroidRuntime(10313): 	at android.os.Looper.loopOnce(Looper.java:226)
E/AndroidRuntime(10313): 	at android.os.Looper.loop(Looper.java:313)
E/AndroidRuntime(10313): 	at android.app.ActivityThread.main(ActivityThread.java:8741)
E/AndroidRuntime(10313): 	at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime(10313): 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:571)
E/AndroidRuntime(10313): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1067)
E/AndroidRuntime(10313): Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'int java.lang.Integer.intValue()' on a null object reference
E/AndroidRuntime(10313): 	at com.samsung.android.secsoundpicker.widget.SecVolumeIcon.h(Unknown Source:18)
E/AndroidRuntime(10313): 	at com.samsung.android.secsoundpicker.widget.SecVolumeIcon.q(Unknown Source:14)
E/AndroidRuntime(10313): 	at com.samsung.android.secsoundpicker.widget.SecVolumeIcon.s(Unknown Source:3)
E/AndroidRuntime(10313): 	at com.samsung.android.secsoundpicker.widget.SecVolumeIcon.c(Unknown Source:43)
E/AndroidRuntime(10313): 	at com.samsung.android.secsoundpicker.widget.SecVolumeSeekBarView.t(Unknown Source:28)
E/AndroidRuntime(10313): 	at com.samsung.android.secsoundpicker.SecSoundPickerActivity.a1(Unknown Source:40)
E/AndroidRuntime(10313): 	at com.samsung.android.secsoundpicker.SecSoundPickerActivity.onCreate(Unknown Source:473)
E/AndroidRuntime(10313): 	at android.app.Activity.performCreate(Activity.java:8578)
E/AndroidRuntime(10313): 	at android.app.Activity.performCreate(Activity.java:8557)
E/AndroidRuntime(10313): 	at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1384)
E/AndroidRuntime(10313): 	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:4147)
E/AndroidRuntime(10313): 	... 12 more

I am testing with S21 running android 13. I can confirm that the same code works flwalessly on S9 running Android 10. I can also confirm that the same code also works with Pixel 5 emulator running android 13.

Any idea what the cause is to this problem on S21 android 13?

1 Like

Hello!

Can you link your application so the developers here can test it?

Hi,

I can confirm this happens to my app as well. Some users has sent their report regarding this bug.

I haven’t released this version of my application yet. It’s still in testing phase, and this is an issue that I came across while migrating the targetSdk to 33 (Android 13).

But as you can see I included the stacktrace. It should be pretty easy to see where the issue is. There is a NullPointerException being thrown in SecVolumeIcon.h in line number 18. I believe this is Samsung’s code.

Can it be that Samsung’s code is expecting some data/information which is not passed in to the Intent object? Below is the piece of code that I use to start the Activity:

void startAlarmTonePickerActivity(@NonNull MethodChannel.Result methodChannelResult, @Nullable String currentUri) {
        Intent intent = new Intent(RingtoneManager.ACTION_RINGTONE_PICKER);
        intent.putExtra(RingtoneManager.EXTRA_RINGTONE_TYPE, RingtoneManager.TYPE_ALARM);
        intent.putExtra(RingtoneManager.EXTRA_RINGTONE_TITLE, "Select alarm tone");
        if (currentUri != null) {
            Uri alarmTone = Uri.parse(currentUri);
            intent.putExtra(RingtoneManager.EXTRA_RINGTONE_EXISTING_URI, alarmTone);
        }
        intent.putExtra(RingtoneManager.EXTRA_RINGTONE_SHOW_SILENT, false);
        intent.putExtra(RingtoneManager.EXTRA_RINGTONE_SHOW_DEFAULT, true);

        Log.v(TAG, "Sending intent " + intent);

        if (activity != null) {
            try {
                activity.startActivityForResult(intent, ALARM_PICKER_REQUEST_CODE);
                this.methodChannelResult = methodChannelResult;
            } catch (Exception e) {
                Log.e(TAG, "Failed to open alarm picker", e);
                methodChannelResult.error("PICK_ERR", "Exception while opening alarm picker", e.getMessage());
            }
        } else {
            Log.w(TAG, "Trying to start intent without activity");
            methodChannelResult.error("PICK_ERR", "Cannot start alarm picker without Activity", null);
        }
    }

Good to here that it’s not specific to my app. Can you confirm that Samsung is addressing this issue?

I had the same issue in my app in OS 13. The issue is caused when setting the intent extra RingtoneManager.EXTRA_RINGTONE_TYPE to RingtoneManager.TYPE_ALARM. If you change it to RingtoneManager.TYPE_RINGTONE or RingtoneManager.TYPE_ALL, it should work.