diff options
author | Jose Lima <joselima@google.com> | 2013-08-22 21:28:14 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2013-08-22 21:28:14 +0000 |
commit | 8f91c33d8d5cd393107d5fb38e4682a5486e4b50 (patch) | |
tree | 91489a037cc3df388c20fae887839fc8bdcc4d22 /services | |
parent | 8e3a41738fba4883f9951406f334567f621db102 (diff) | |
parent | bb9682e12009aaad696f0b162085efc4b94f5048 (diff) | |
download | frameworks_base-8f91c33d8d5cd393107d5fb38e4682a5486e4b50.zip frameworks_base-8f91c33d8d5cd393107d5fb38e4682a5486e4b50.tar.gz frameworks_base-8f91c33d8d5cd393107d5fb38e4682a5486e4b50.tar.bz2 |
Merge "Allow replacing ResolverActivity via config value" into klp-dev
Diffstat (limited to 'services')
-rwxr-xr-x | services/java/com/android/server/pm/PackageManagerService.java | 81 |
1 files changed, 64 insertions, 17 deletions
diff --git a/services/java/com/android/server/pm/PackageManagerService.java b/services/java/com/android/server/pm/PackageManagerService.java index 78c1c79..4942141 100755 --- a/services/java/com/android/server/pm/PackageManagerService.java +++ b/services/java/com/android/server/pm/PackageManagerService.java @@ -91,6 +91,7 @@ import android.content.pm.ManifestDigest; import android.content.pm.VerificationParams; import android.content.pm.VerifierDeviceIdentity; import android.content.pm.VerifierInfo; +import android.content.res.Resources; import android.net.Uri; import android.os.Binder; import android.os.Build; @@ -116,6 +117,7 @@ import android.os.Environment.UserEnvironment; import android.os.UserManager; import android.security.KeyStore; import android.security.SystemKeyStore; +import android.text.TextUtils; import android.util.DisplayMetrics; import android.util.EventLog; import android.util.Log; @@ -158,6 +160,8 @@ import libcore.io.IoUtils; import libcore.io.Libcore; import libcore.io.StructStat; +import com.android.internal.R; + /** * Keep track of all those .apks everywhere. * @@ -420,6 +424,9 @@ public class PackageManagerService extends IPackageManager.Stub { final ResolveInfo mResolveInfo = new ResolveInfo(); ComponentName mResolveComponentName; PackageParser.Package mPlatformPackage; + ComponentName mCustomResolverComponentName; + + boolean mResolverReplaced = false; // Set of pending broadcasts for aggregating enable/disable of components. static class PendingPackageBroadcasts { @@ -1115,6 +1122,15 @@ public class PackageManagerService extends IPackageManager.Stub { mRestoredSettings = mSettings.readLPw(this, sUserManager.getUsers(false), mSdkVersion, mOnlyCore); + String customResolverActivity = Resources.getSystem().getString( + R.string.config_customResolverActivity); + if (TextUtils.isEmpty(customResolverActivity)) { + customResolverActivity = null; + } else { + mCustomResolverComponentName = ComponentName.unflattenFromString( + customResolverActivity); + } + long startTime = SystemClock.uptimeMillis(); EventLog.writeEvent(EventLogTags.BOOT_PROGRESS_PMS_SYSTEM_SCAN_START, @@ -3979,6 +3995,11 @@ public class PackageManagerService extends IPackageManager.Stub { pkg.applicationInfo.flags |= ApplicationInfo.FLAG_PRIVILEGED; } + if (mCustomResolverComponentName != null && + mCustomResolverComponentName.getPackageName().equals(pkg.packageName)) { + setUpCustomResolverActivity(pkg); + } + if (pkg.packageName.equals("android")) { synchronized (mPackages) { if (mAndroidApplication != null) { @@ -3990,26 +4011,28 @@ public class PackageManagerService extends IPackageManager.Stub { return null; } - // Set up information for our fall-back user intent resolution - // activity. + // Set up information for our fall-back user intent resolution activity. mPlatformPackage = pkg; pkg.mVersionCode = mSdkVersion; mAndroidApplication = pkg.applicationInfo; - mResolveActivity.applicationInfo = mAndroidApplication; - mResolveActivity.name = ResolverActivity.class.getName(); - mResolveActivity.packageName = mAndroidApplication.packageName; - mResolveActivity.processName = "system:ui"; - mResolveActivity.launchMode = ActivityInfo.LAUNCH_MULTIPLE; - mResolveActivity.flags = ActivityInfo.FLAG_EXCLUDE_FROM_RECENTS; - mResolveActivity.theme = com.android.internal.R.style.Theme_Holo_Dialog_Alert; - mResolveActivity.exported = true; - mResolveActivity.enabled = true; - mResolveInfo.activityInfo = mResolveActivity; - mResolveInfo.priority = 0; - mResolveInfo.preferredOrder = 0; - mResolveInfo.match = 0; - mResolveComponentName = new ComponentName( - mAndroidApplication.packageName, mResolveActivity.name); + + if (!mResolverReplaced) { + mResolveActivity.applicationInfo = mAndroidApplication; + mResolveActivity.name = ResolverActivity.class.getName(); + mResolveActivity.packageName = mAndroidApplication.packageName; + mResolveActivity.processName = "system:ui"; + mResolveActivity.launchMode = ActivityInfo.LAUNCH_MULTIPLE; + mResolveActivity.flags = ActivityInfo.FLAG_EXCLUDE_FROM_RECENTS; + mResolveActivity.theme = com.android.internal.R.style.Theme_Holo_Dialog_Alert; + mResolveActivity.exported = true; + mResolveActivity.enabled = true; + mResolveInfo.activityInfo = mResolveActivity; + mResolveInfo.priority = 0; + mResolveInfo.preferredOrder = 0; + mResolveInfo.match = 0; + mResolveComponentName = new ComponentName( + mAndroidApplication.packageName, mResolveActivity.name); + } } } @@ -4874,6 +4897,30 @@ public class PackageManagerService extends IPackageManager.Stub { return pkg; } + private void setUpCustomResolverActivity(PackageParser.Package pkg) { + synchronized (mPackages) { + mResolverReplaced = true; + // Set up information for custom user intent resolution activity. + mResolveActivity.applicationInfo = pkg.applicationInfo; + mResolveActivity.name = mCustomResolverComponentName.getClassName(); + mResolveActivity.packageName = pkg.applicationInfo.packageName; + mResolveActivity.processName = null; + mResolveActivity.launchMode = ActivityInfo.LAUNCH_MULTIPLE; + mResolveActivity.flags = ActivityInfo.FLAG_EXCLUDE_FROM_RECENTS | + ActivityInfo.FLAG_FINISH_ON_CLOSE_SYSTEM_DIALOGS; + mResolveActivity.theme = 0; + mResolveActivity.exported = true; + mResolveActivity.enabled = true; + mResolveInfo.activityInfo = mResolveActivity; + mResolveInfo.priority = 0; + mResolveInfo.preferredOrder = 0; + mResolveInfo.match = 0; + mResolveComponentName = mCustomResolverComponentName; + Slog.i(TAG, "Replacing default ResolverActivity with custom activity: " + + mResolveComponentName); + } + } + private void setInternalAppNativeLibraryPath(PackageParser.Package pkg, PackageSetting pkgSetting) { final String apkLibPath = getApkName(pkgSetting.codePathString); |