From fbd0e9fa37fc17ccd25e4c1f16195bbd27de3c4c Mon Sep 17 00:00:00 2001 From: Jeff Sharkey Date: Wed, 6 Aug 2014 16:34:34 -0700 Subject: Surface user action events when un/installing. This will be used shortly to connect up with permissions confirmation UI. Bug: 16515814 Change-Id: If28cecc28549900d960ac107a1fba0b10ce5bd7b --- cmds/pm/src/com/android/commands/pm/Pm.java | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'cmds/pm') diff --git a/cmds/pm/src/com/android/commands/pm/Pm.java b/cmds/pm/src/com/android/commands/pm/Pm.java index 1f25dd0..c5e91e3 100644 --- a/cmds/pm/src/com/android/commands/pm/Pm.java +++ b/cmds/pm/src/com/android/commands/pm/Pm.java @@ -19,12 +19,13 @@ package com.android.commands.pm; import android.app.ActivityManager; import android.app.ActivityManagerNative; import android.app.IActivityManager; +import android.app.PackageDeleteObserver; import android.app.PackageInstallObserver; import android.content.ComponentName; +import android.content.Intent; import android.content.pm.ApplicationInfo; import android.content.pm.FeatureInfo; import android.content.pm.IPackageDataObserver; -import android.content.pm.IPackageDeleteObserver; import android.content.pm.IPackageInstaller; import android.content.pm.IPackageManager; import android.content.pm.InstallSessionInfo; @@ -760,7 +761,7 @@ public final class Pm { String extraPackage; @Override - public void packageInstalled(String name, Bundle extras, int status) { + public void onPackageInstalled(String name, int status, String msg, Bundle extras) { synchronized (this) { finished = true; result = status; @@ -790,6 +791,11 @@ public final class Pm { } @Override + public void onUserActionRequired(Intent intent) { + setResult(false, "Unexepected user action required!"); + } + + @Override public void onSuccess() { setResult(true, null); } @@ -1268,11 +1274,12 @@ public final class Pm { } } - class PackageDeleteObserver extends IPackageDeleteObserver.Stub { + class LocalPackageDeleteObserver extends PackageDeleteObserver { boolean finished; boolean result; - public void packageDeleted(String packageName, int returnCode) { + @Override + public void onPackageDeleted(String name, int returnCode, String msg) { synchronized (this) { finished = true; result = returnCode == PackageManager.DELETE_SUCCEEDED; @@ -1346,9 +1353,9 @@ public final class Pm { } private boolean deletePackage(String packageName, int flags, int userId) { - PackageDeleteObserver obs = new PackageDeleteObserver(); + LocalPackageDeleteObserver obs = new LocalPackageDeleteObserver(); try { - mInstaller.uninstall(packageName, flags, obs, userId); + mInstaller.uninstall(packageName, flags, obs.getBinder(), userId); synchronized (obs) { while (!obs.finished) { -- cgit v1.1