fail fast if privService.getInstalledPackages() isn't working

If `privService.getInstalledPackages()` throws something other than a
`RemoteException`, this should fail as fast as possible.  Crashing will give
users a prompt to send the crash report.  using `finally` will just cause
weirdness since it might try to execute `compareToPackageManager()` even
when it is in the process of crashing.
This commit is contained in:
Hans-Christoph Steiner 2021-03-03 18:44:43 +01:00
parent 6710b74477
commit bde60282f1

View File

@ -196,10 +196,9 @@ public class InstalledAppProviderService extends JobIntentService {
try { try {
packageInfoList = privService.getInstalledPackages(PackageManager.GET_SIGNATURES); packageInfoList = privService.getInstalledPackages(PackageManager.GET_SIGNATURES);
} catch (RemoteException e) { } catch (RemoteException e) {
Log.e(TAG, "RemoteException", e); e.printStackTrace();
} finally {
compareToPackageManager(context, packageInfoList);
} }
compareToPackageManager(context, packageInfoList);
} }
@Override @Override
@ -213,9 +212,7 @@ public class InstalledAppProviderService extends JobIntentService {
context.getApplicationContext().bindService(serviceIntent, mServiceConnection, context.getApplicationContext().bindService(serviceIntent, mServiceConnection,
Context.BIND_AUTO_CREATE); Context.BIND_AUTO_CREATE);
} else { } else {
List<PackageInfo> packageInfoList = context.getPackageManager() compareToPackageManager(context, null);
.getInstalledPackages(PackageManager.GET_SIGNATURES);
compareToPackageManager(context, packageInfoList);
} }
} }