Loading media/java/android/media/AudioService.java +9 −3 Original line number Diff line number Diff line Loading @@ -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 Loading Loading
media/java/android/media/AudioService.java +9 −3 Original line number Diff line number Diff line Loading @@ -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 Loading