summaryrefslogtreecommitdiffstats
path: root/services/core/java/com/android/server/audio/AudioService.java
diff options
context:
space:
mode:
Diffstat (limited to 'services/core/java/com/android/server/audio/AudioService.java')
-rw-r--r--services/core/java/com/android/server/audio/AudioService.java13
1 files changed, 9 insertions, 4 deletions
diff --git a/services/core/java/com/android/server/audio/AudioService.java b/services/core/java/com/android/server/audio/AudioService.java
index 7b5db46..2e24737 100644
--- a/services/core/java/com/android/server/audio/AudioService.java
+++ b/services/core/java/com/android/server/audio/AudioService.java
@@ -35,6 +35,7 @@ import android.bluetooth.BluetoothClass;
import android.bluetooth.BluetoothDevice;
import android.bluetooth.BluetoothHeadset;
import android.bluetooth.BluetoothProfile;
+import android.content.ActivityNotFoundException;
import android.content.BroadcastReceiver;
import android.content.ComponentName;
import android.content.ContentResolver;
@@ -5133,10 +5134,14 @@ public class AudioService extends IAudioService.Stub {
TelecomManager tm = (TelecomManager) mContext.getSystemService(Context.TELECOM_SERVICE);
if (launchPlayer && !tm.isInCall()) {
- Intent playerIntent = new Intent(Intent.ACTION_MAIN);
- playerIntent.addCategory(Intent.CATEGORY_APP_MUSIC);
- playerIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
- mContext.startActivity(playerIntent);
+ try {
+ Intent playerIntent = new Intent(Intent.ACTION_MAIN);
+ playerIntent.addCategory(Intent.CATEGORY_APP_MUSIC);
+ playerIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+ mContext.startActivity(playerIntent);
+ } catch (ActivityNotFoundException | IllegalArgumentException e) {
+ Log.w(TAG, "No music player Activity could be found");
+ }
}
}