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