diff options
8 files changed, 45 insertions, 2 deletions
diff --git a/core/java/android/app/ApplicationPackageManager.java b/core/java/android/app/ApplicationPackageManager.java index 854719d..967e97e 100644 --- a/core/java/android/app/ApplicationPackageManager.java +++ b/core/java/android/app/ApplicationPackageManager.java @@ -1609,6 +1609,18 @@ final class ApplicationPackageManager extends PackageManager { return null; } + /** + * @hide + */ + @Override + public boolean isUpgrade() { + try { + return mPM.isUpgrade(); + } catch (RemoteException e) { + return false; + } + } + @Override public PackageInstaller getPackageInstaller() { synchronized (mLock) { diff --git a/core/java/android/content/pm/IPackageManager.aidl b/core/java/android/content/pm/IPackageManager.aidl index c37534a..0dc86ad 100644 --- a/core/java/android/content/pm/IPackageManager.aidl +++ b/core/java/android/content/pm/IPackageManager.aidl @@ -436,6 +436,7 @@ interface IPackageManager { boolean isFirstBoot(); boolean isOnlyCoreApps(); + boolean isUpgrade(); void setPermissionEnforced(String permission, boolean enforced); boolean isPermissionEnforced(String permission); diff --git a/core/java/android/content/pm/PackageManager.java b/core/java/android/content/pm/PackageManager.java index ab90b66..e9f7c50 100644 --- a/core/java/android/content/pm/PackageManager.java +++ b/core/java/android/content/pm/PackageManager.java @@ -3867,6 +3867,13 @@ public abstract class PackageManager { public abstract VerifierDeviceIdentity getVerifierDeviceIdentity(); /** + * Returns true if the device is upgrading, such as first boot after OTA. + * + * @hide + */ + public abstract boolean isUpgrade(); + + /** * Return interface that offers the ability to install, upgrade, and remove * applications on the device. */ diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml index 99d15cc..5b6ff1c 100644 --- a/core/res/res/values/strings.xml +++ b/core/res/res/values/strings.xml @@ -3509,6 +3509,9 @@ <!-- [CHAR LIMIT=40] Title of dialog that is shown when performing a system upgrade. --> <string name="android_upgrading_title">Android is upgrading\u2026</string> + <!-- [CHAR LIMIT=40] Title of dialog that is shown when system is starting. --> + <string name="android_start_title">Android is starting\u2026</string> + <!-- [CHAR LIMIT=NONE] Message shown in upgrading dialog for each .apk that is optimized. --> <string name="android_upgrading_apk">Optimizing app <xliff:g id="number" example="123">%1$d</xliff:g> of diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml index d86413f..4a3279e 100644 --- a/core/res/res/values/symbols.xml +++ b/core/res/res/values/symbols.xml @@ -1491,6 +1491,7 @@ <java-symbol type="layout" name="screen_title" /> <java-symbol type="layout" name="screen_title_icons" /> <java-symbol type="string" name="system_ui_date_pattern" /> + <java-symbol type="string" name="android_start_title" /> <java-symbol type="string" name="android_upgrading_title" /> <java-symbol type="string" name="bugreport_title" /> <java-symbol type="string" name="bugreport_message" /> diff --git a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java index 558cf56..fb2a17b 100644 --- a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java +++ b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java @@ -5352,7 +5352,11 @@ public class PhoneWindowManager implements WindowManagerPolicy { return true; } }; - mBootMsgDialog.setTitle(R.string.android_upgrading_title); + if (mContext.getPackageManager().isUpgrade()) { + mBootMsgDialog.setTitle(R.string.android_upgrading_title); + } else { + mBootMsgDialog.setTitle(R.string.android_start_title); + } mBootMsgDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER); mBootMsgDialog.setIndeterminate(true); mBootMsgDialog.getWindow().setType( diff --git a/services/core/java/com/android/server/pm/PackageManagerService.java b/services/core/java/com/android/server/pm/PackageManagerService.java index de6e82b..22ab1db 100644 --- a/services/core/java/com/android/server/pm/PackageManagerService.java +++ b/services/core/java/com/android/server/pm/PackageManagerService.java @@ -333,6 +333,7 @@ public class PackageManagerService extends IPackageManager.Stub { final DisplayMetrics mMetrics; final int mDefParseFlags; final String[] mSeparateProcesses; + final boolean mIsUpgrade; // This is where all application persistent data goes. final File mAppDataDir; @@ -1760,7 +1761,8 @@ public class PackageManagerService extends IPackageManager.Stub { // If this is first boot after an OTA, and a normal boot, then // we need to clear code cache directories. - if (!Build.FINGERPRINT.equals(mSettings.mFingerprint) && !onlyCore) { + mIsUpgrade = !Build.FINGERPRINT.equals(mSettings.mFingerprint); + if (mIsUpgrade && !onlyCore) { Slog.i(TAG, "Build fingerprint changed; clearing code caches"); for (String pkgName : mSettings.mPackages.keySet()) { deleteCodeCacheDirsLI(pkgName); @@ -1800,6 +1802,11 @@ public class PackageManagerService extends IPackageManager.Stub { return mOnlyCore; } + @Override + public boolean isUpgrade() { + return mIsUpgrade; + } + private String getRequiredVerifierLPr() { final Intent verification = new Intent(Intent.ACTION_PACKAGE_NEEDS_VERIFICATION); final List<ResolveInfo> receivers = queryIntentReceivers(verification, PACKAGE_MIME_TYPE, diff --git a/test-runner/src/android/test/mock/MockPackageManager.java b/test-runner/src/android/test/mock/MockPackageManager.java index 7f1dc71..7531d7b 100644 --- a/test-runner/src/android/test/mock/MockPackageManager.java +++ b/test-runner/src/android/test/mock/MockPackageManager.java @@ -733,6 +733,14 @@ public class MockPackageManager extends PackageManager { * @hide */ @Override + public boolean isUpgrade() { + throw new UnsupportedOperationException(); + } + + /** + * @hide + */ + @Override public void installPackage(Uri packageURI, PackageInstallObserver observer, int flags, String installerPackageName) { throw new UnsupportedOperationException(); |