Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 90b6431a authored by Ricardo Cerqueira's avatar Ricardo Cerqueira Committed by Gerrit Code Review
Browse files

Merge "Fix up 'launch player on headset connection' option." into cm-10.2

parents b291f2f8 a6c5defc
Loading
Loading
Loading
Loading
+9 −3
Original line number Diff line number Diff line
@@ -4144,13 +4144,19 @@ public class AudioService extends IAudioService.Stub implements OnFinished {
                    adjustCurrentStreamVolume();
                    // TODO: Cap volume at safe levels

                    boolean launchPlayer = Settings.System.getInt(context.getContentResolver(),
                            Settings.System.HEADSET_CONNECT_PLAYER, 0) != 0;
                    boolean launchPlayer = Settings.System.getIntForUser(
                            context.getContentResolver(),
                            Settings.System.HEADSET_CONNECT_PLAYER,
                            0, UserHandle.USER_CURRENT) != 0;
                    if (launchPlayer) {
                        Intent playerIntent = new Intent(Intent.ACTION_MAIN);
                        playerIntent.addCategory(Intent.CATEGORY_APP_MUSIC);
                        playerIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                        try {
                            context.startActivity(playerIntent);
                        } catch (ActivityNotFoundException e) {
                            Log.w(TAG, "No music player found to start after headset connection");
                        }
                    }
                } else {
                    // Headset disconnected