Loading service/src/com/android/server/bluetooth/BluetoothManagerService.java +32 −2 Original line number Diff line number Diff line Loading @@ -115,6 +115,7 @@ import java.util.concurrent.Executors; import java.util.concurrent.FutureTask; import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; import java.util.stream.Collectors; class BluetoothManagerService { private static final String TAG = BluetoothManagerService.class.getSimpleName(); Loading Loading @@ -1830,7 +1831,7 @@ class BluetoothManagerService { int flags = Context.BIND_AUTO_CREATE | Context.BIND_IMPORTANT; Intent intent = new Intent(IBluetooth.class.getName()); ComponentName comp = resolveSystemService(intent); if (comp == null) { if (comp == null && !Flags.enforceResolveSystemServiceBehavior()) { Log.e(TAG, "No ComponentName found for intent=" + intent); return; } Loading Loading @@ -2309,7 +2310,7 @@ class BluetoothManagerService { return bOptions.toBundle(); } private ComponentName resolveSystemService(@NonNull Intent intent) { private ComponentName legacyresolveSystemService(@NonNull Intent intent) { List<ResolveInfo> results = mContext.getPackageManager().queryIntentServices(intent, 0); if (results == null) { return null; Loading Loading @@ -2337,6 +2338,35 @@ class BluetoothManagerService { return comp; } private ComponentName resolveSystemService(@NonNull Intent intent) { if (!Flags.enforceResolveSystemServiceBehavior()) { return legacyresolveSystemService(intent); } List<ComponentName> results = mContext.getPackageManager().queryIntentServices(intent, 0).stream() .filter( ri -> (ri.serviceInfo.applicationInfo.flags & ApplicationInfo.FLAG_SYSTEM) != 0) .map( ri -> new ComponentName( ri.serviceInfo.applicationInfo.packageName, ri.serviceInfo.name)) .collect(Collectors.toList()); switch (results.size()) { case 0 -> throw new IllegalStateException("No services can handle intent " + intent); case 1 -> { return results.get(0); } default -> { throw new IllegalStateException( "Multiples services can handle intent " + intent + ": " + results); } } } int setBtHciSnoopLogMode(int mode) { final BluetoothProperties.snoop_log_mode_values snoopMode; Loading Loading
service/src/com/android/server/bluetooth/BluetoothManagerService.java +32 −2 Original line number Diff line number Diff line Loading @@ -115,6 +115,7 @@ import java.util.concurrent.Executors; import java.util.concurrent.FutureTask; import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; import java.util.stream.Collectors; class BluetoothManagerService { private static final String TAG = BluetoothManagerService.class.getSimpleName(); Loading Loading @@ -1830,7 +1831,7 @@ class BluetoothManagerService { int flags = Context.BIND_AUTO_CREATE | Context.BIND_IMPORTANT; Intent intent = new Intent(IBluetooth.class.getName()); ComponentName comp = resolveSystemService(intent); if (comp == null) { if (comp == null && !Flags.enforceResolveSystemServiceBehavior()) { Log.e(TAG, "No ComponentName found for intent=" + intent); return; } Loading Loading @@ -2309,7 +2310,7 @@ class BluetoothManagerService { return bOptions.toBundle(); } private ComponentName resolveSystemService(@NonNull Intent intent) { private ComponentName legacyresolveSystemService(@NonNull Intent intent) { List<ResolveInfo> results = mContext.getPackageManager().queryIntentServices(intent, 0); if (results == null) { return null; Loading Loading @@ -2337,6 +2338,35 @@ class BluetoothManagerService { return comp; } private ComponentName resolveSystemService(@NonNull Intent intent) { if (!Flags.enforceResolveSystemServiceBehavior()) { return legacyresolveSystemService(intent); } List<ComponentName> results = mContext.getPackageManager().queryIntentServices(intent, 0).stream() .filter( ri -> (ri.serviceInfo.applicationInfo.flags & ApplicationInfo.FLAG_SYSTEM) != 0) .map( ri -> new ComponentName( ri.serviceInfo.applicationInfo.packageName, ri.serviceInfo.name)) .collect(Collectors.toList()); switch (results.size()) { case 0 -> throw new IllegalStateException("No services can handle intent " + intent); case 1 -> { return results.get(0); } default -> { throw new IllegalStateException( "Multiples services can handle intent " + intent + ": " + results); } } } int setBtHciSnoopLogMode(int mode) { final BluetoothProperties.snoop_log_mode_values snoopMode; Loading