summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnthony Hugh <ahugh@google.com>2015-12-05 02:09:01 +0000
committerandroid-build-merger <android-build-merger@google.com>2015-12-05 02:09:01 +0000
commitbf00c684a0edf1edda97203f123878d784e3a789 (patch)
treeab7dd4003c545d0dd87244000e517817a1d7c734
parenta008f56e6e9e9395be155702483dd220ae6a89f9 (diff)
parent59f758a01daf2f0bdd46aa33b2dcf6ae45a457c1 (diff)
downloadandroid_packages_apps_PackageInstaller-bf00c684a0edf1edda97203f123878d784e3a789.tar.gz
android_packages_apps_PackageInstaller-bf00c684a0edf1edda97203f123878d784e3a789.tar.bz2
android_packages_apps_PackageInstaller-bf00c684a0edf1edda97203f123878d784e3a789.zip
Fix wake lock leak am: cfc6b97c7d am: 546c1ffab6
am: 59f758a01d * commit '59f758a01daf2f0bdd46aa33b2dcf6ae45a457c1': Fix wake lock leak
-rw-r--r--src/com/android/packageinstaller/wear/WearPackageInstallerService.java59
1 files changed, 32 insertions, 27 deletions
diff --git a/src/com/android/packageinstaller/wear/WearPackageInstallerService.java b/src/com/android/packageinstaller/wear/WearPackageInstallerService.java
index 6dc5aa70..229a3df6 100644
--- a/src/com/android/packageinstaller/wear/WearPackageInstallerService.java
+++ b/src/com/android/packageinstaller/wear/WearPackageInstallerService.java
@@ -586,31 +586,33 @@ public class WearPackageInstallerService extends Service {
}
public void packageInstalled(String packageName, int returnCode) {
- // If installation failed, bail out and remove the ShowPermsStore entry
- if (returnCode < 0) {
- Log.e(TAG, "Package install failed " + mApplicationPackageName
- + ", returnCode " + returnCode);
- WearPackageUtil.removeFromPermStore(mContext, mApplicationPackageName);
- return;
- }
+ try {
+ // If installation failed, bail out and remove the ShowPermsStore entry
+ if (returnCode < 0) {
+ Log.e(TAG, "Package install failed " + mApplicationPackageName
+ + ", returnCode " + returnCode);
+ WearPackageUtil.removeFromPermStore(mContext, mApplicationPackageName);
+ return;
+ }
- Log.i(TAG, "Package " + packageName + " was installed.");
+ Log.i(TAG, "Package " + packageName + " was installed.");
- // Delete tempFile from the file system.
- File tempFile = WearPackageUtil.getTemporaryFile(mContext, packageName);
- if (tempFile != null) {
- tempFile.delete();
- }
+ // Delete tempFile from the file system.
+ File tempFile = WearPackageUtil.getTemporaryFile(mContext, packageName);
+ if (tempFile != null) {
+ tempFile.delete();
+ }
- // Broadcast the "UPDATED" gmscore intent, normally sent by play store.
- // TODO: Remove this broadcast if/when we get the play store to do this for us.
- if (GMS_PACKAGE_NAME.equals(packageName)) {
- Intent gmsInstalledIntent = new Intent(GMS_UPDATED_BROADCAST);
- gmsInstalledIntent.setPackage(GMS_PACKAGE_NAME);
- mContext.sendBroadcast(gmsInstalledIntent);
+ // Broadcast the "UPDATED" gmscore intent, normally sent by play store.
+ // TODO: Remove this broadcast if/when we get the play store to do this for us.
+ if (GMS_PACKAGE_NAME.equals(packageName)) {
+ Intent gmsInstalledIntent = new Intent(GMS_UPDATED_BROADCAST);
+ gmsInstalledIntent.setPackage(GMS_PACKAGE_NAME);
+ mContext.sendBroadcast(gmsInstalledIntent);
+ }
+ } finally {
+ finishService(mWakeLock, mStartId);
}
-
- finishService(mWakeLock, mStartId);
}
}
@@ -624,13 +626,16 @@ public class WearPackageInstallerService extends Service {
}
public void packageDeleted(String packageName, int returnCode) {
- if (returnCode >= 0) {
- Log.i(TAG, "Package " + packageName + " was uninstalled.");
- } else {
- Log.e(TAG, "Package uninstall failed " + packageName + ", returnCode " +
- returnCode);
+ try {
+ if (returnCode >= 0) {
+ Log.i(TAG, "Package " + packageName + " was uninstalled.");
+ } else {
+ Log.e(TAG, "Package uninstall failed " + packageName + ", returnCode " +
+ returnCode);
+ }
+ } finally {
+ finishService(mWakeLock, mStartId);
}
- finishService(mWakeLock, mStartId);
}
}
}