summaryrefslogtreecommitdiffstats
path: root/services/java/com
diff options
context:
space:
mode:
authorDoug Zongker <dougz@android.com>2010-04-05 15:07:36 -0700
committerDoug Zongker <dougz@android.com>2010-04-05 15:10:31 -0700
commit944ff0b788bf1702bad38d21cc2b83a9985dd112 (patch)
tree4ce51b51cbaf07890c839c993fe1be5dbd034f03 /services/java/com
parent44dcf658718fcc0b563dcad50fb59e8fe507cd0a (diff)
downloadframeworks_base-944ff0b788bf1702bad38d21cc2b83a9985dd112.zip
frameworks_base-944ff0b788bf1702bad38d21cc2b83a9985dd112.tar.gz
frameworks_base-944ff0b788bf1702bad38d21cc2b83a9985dd112.tar.bz2
remove OTA packages from the old (pre-froyo) updater
The old updater ran in the system process, so only that UID can delete its downloads. Do this on startup in case we've just upgraded from something before froyo and need to clean up those packages. b/2571619 - eclair -> froyo update package not deleted Change-Id: I0a5e7834c3ecd2cc2f6fd73052b3a38e1294b5d5
Diffstat (limited to 'services/java/com')
-rw-r--r--services/java/com/android/server/BootReceiver.java20
1 files changed, 20 insertions, 0 deletions
diff --git a/services/java/com/android/server/BootReceiver.java b/services/java/com/android/server/BootReceiver.java
index 15aad0e..f409751 100644
--- a/services/java/com/android/server/BootReceiver.java
+++ b/services/java/com/android/server/BootReceiver.java
@@ -21,6 +21,7 @@ import android.content.ContentResolver;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
+import android.net.Downloads;
import android.os.Build;
import android.os.DropBoxManager;
import android.os.FileObserver;
@@ -45,6 +46,14 @@ public class BootReceiver extends BroadcastReceiver {
private static final File TOMBSTONE_DIR = new File("/data/tombstones");
+ // The pre-froyo package and class of the system updater, which
+ // ran in the system process. We need to remove its packages here
+ // in order to clean up after a pre-froyo-to-froyo update.
+ private static final String OLD_UPDATER_PACKAGE =
+ "com.google.android.systemupdater";
+ private static final String OLD_UPDATER_CLASS =
+ "com.google.android.systemupdater.SystemUpdateReceiver";
+
// Keep a reference to the observer so the finalizer doesn't disable it.
private static FileObserver sTombstoneObserver = null;
@@ -70,10 +79,21 @@ public class BootReceiver extends BroadcastReceiver {
} catch (Exception e) {
Slog.e(TAG, "Can't log boot events", e);
}
+ try {
+ removeOldUpdatePackages(context);
+ } catch (Exception e) {
+ Slog.e(TAG, "Can't remove old update packages", e);
+ }
+
}
}.start();
}
+ private void removeOldUpdatePackages(Context ctx) {
+ Downloads.ByUri.removeAllDownloadsByPackage(
+ ctx, OLD_UPDATER_PACKAGE, OLD_UPDATER_CLASS);
+ }
+
private void logBootEvents(Context ctx) throws IOException {
final DropBoxManager db = (DropBoxManager) ctx.getSystemService(Context.DROPBOX_SERVICE);
final SharedPreferences prefs = ctx.getSharedPreferences("log_files", Context.MODE_PRIVATE);