Add progress dialog for booting after an upgrade.
This introduces a new facility for code during the boot process
to display messages to the user through a progress dialog. This
is only for use when performing longer-than-usual post-upgrade
operations such as running dexopt on applications or upgrading
databases.
Change-Id: I0e78439ccec3850fb67872c22f235bf12a158dae
diff --git a/core/java/android/app/ActivityManagerNative.java b/core/java/android/app/ActivityManagerNative.java
index 8901fc8..7799779 100644
--- a/core/java/android/app/ActivityManagerNative.java
+++ b/core/java/android/app/ActivityManagerNative.java
@@ -1541,6 +1541,15 @@
return true;
}
+ case SHOW_BOOT_MESSAGE_TRANSACTION: {
+ data.enforceInterface(IActivityManager.descriptor);
+ CharSequence msg = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
+ boolean always = data.readInt() != 0;
+ showBootMessage(msg, always);
+ reply.writeNoException();
+ return true;
+ }
+
}
return super.onTransact(code, data, reply, flags);
@@ -3483,5 +3492,17 @@
return res;
}
+ public void showBootMessage(CharSequence msg, boolean always) throws RemoteException {
+ Parcel data = Parcel.obtain();
+ Parcel reply = Parcel.obtain();
+ data.writeInterfaceToken(IActivityManager.descriptor);
+ TextUtils.writeToParcel(msg, data, 0);
+ data.writeInt(always ? 1 : 0);
+ mRemote.transact(SHOW_BOOT_MESSAGE_TRANSACTION, data, reply, 0);
+ reply.readException();
+ data.recycle();
+ reply.recycle();
+ }
+
private IBinder mRemote;
}
diff --git a/core/java/android/app/IActivityManager.java b/core/java/android/app/IActivityManager.java
index 49f8449..27dd691 100644
--- a/core/java/android/app/IActivityManager.java
+++ b/core/java/android/app/IActivityManager.java
@@ -370,6 +370,8 @@
public long[] getProcessPss(int[] pids) throws RemoteException;
+ public void showBootMessage(CharSequence msg, boolean always) throws RemoteException;
+
/*
* Private non-Binder interfaces
*/
@@ -599,4 +601,5 @@
int IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+134;
int UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+135;
int GET_PROCESS_PSS_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+136;
+ int SHOW_BOOT_MESSAGE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+137;
}
diff --git a/core/java/android/content/pm/IPackageManager.aidl b/core/java/android/content/pm/IPackageManager.aidl
index d7607e3..08aef16 100644
--- a/core/java/android/content/pm/IPackageManager.aidl
+++ b/core/java/android/content/pm/IPackageManager.aidl
@@ -320,7 +320,13 @@
boolean isSafeMode();
void systemReady();
boolean hasSystemUidErrors();
-
+
+ /**
+ * Ask the package manager to perform boot-time dex-opt of all
+ * existing packages.
+ */
+ void performBootDexOpt();
+
/**
* Ask the package manager to perform dex-opt (if needed) on the given
* package, if it already hasn't done mode. Only does this if running
diff --git a/core/java/android/database/sqlite/SQLiteOpenHelper.java b/core/java/android/database/sqlite/SQLiteOpenHelper.java
index e2befca..56cf948 100644
--- a/core/java/android/database/sqlite/SQLiteOpenHelper.java
+++ b/core/java/android/database/sqlite/SQLiteOpenHelper.java
@@ -100,6 +100,14 @@
}
/**
+ * Return the name of the SQLite database being opened, as given tp
+ * the constructor.
+ */
+ public String getDatabaseName() {
+ return mName;
+ }
+
+ /**
* Create and/or open a database that will be used for reading and writing.
* The first time this is called, the database will be opened and
* {@link #onCreate}, {@link #onUpgrade} and/or {@link #onOpen} will be
diff --git a/core/java/android/view/Window.java b/core/java/android/view/Window.java
index e0e1a1a..75c7592 100644
--- a/core/java/android/view/Window.java
+++ b/core/java/android/view/Window.java
@@ -127,6 +127,7 @@
private int mLocalFeatures = DEFAULT_FEATURES;
private boolean mHaveWindowFormat = false;
+ private boolean mHaveDimAmount = false;
private int mDefaultWindowFormat = PixelFormat.OPAQUE;
private boolean mHasSoftInputMode = false;
@@ -745,6 +746,23 @@
}
/**
+ * Set the amount of dim behind the window when using
+ * {@link WindowManager.LayoutParams#FLAG_DIM_BEHIND}. This overrides
+ * the default dim amount of that is selected by the Window based on
+ * its theme.
+ *
+ * @param amount The new dim amount, from 0 for no dim to 1 for full dim.
+ */
+ public void setDimAmount(float amount) {
+ final WindowManager.LayoutParams attrs = getAttributes();
+ attrs.dimAmount = amount;
+ mHaveDimAmount = true;
+ if (mCallback != null) {
+ mCallback.onWindowAttributesChanged(attrs);
+ }
+ }
+
+ /**
* Specify custom window attributes. <strong>PLEASE NOTE:</strong> the
* layout params you give here should generally be from values previously
* retrieved with {@link #getAttributes()}; you probably do not want to
@@ -1193,6 +1211,11 @@
}
}
+ /** @hide */
+ protected boolean haveDimAmount() {
+ return mHaveDimAmount;
+ }
+
public abstract void setChildDrawable(int featureId, Drawable drawable);
public abstract void setChildInt(int featureId, int value);
diff --git a/core/java/android/view/WindowManagerPolicy.java b/core/java/android/view/WindowManagerPolicy.java
index 8a30c7b..1b4edf1 100644
--- a/core/java/android/view/WindowManagerPolicy.java
+++ b/core/java/android/view/WindowManagerPolicy.java
@@ -871,6 +871,16 @@
public void systemReady();
/**
+ * Show boot time message to the user.
+ */
+ public void showBootMessage(final CharSequence msg, final boolean always);
+
+ /**
+ * Hide the UI for showing boot messages, never to be displayed again.
+ */
+ public void hideBootMessages();
+
+ /**
* Called when userActivity is signalled in the power manager.
* This is safe to call from any thread, with any window manager locks held or not.
*/
diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml
index 27fa8d4..c80923d 100755
--- a/core/res/res/values/strings.xml
+++ b/core/res/res/values/strings.xml
@@ -2571,6 +2571,20 @@
<string name="smv_process">The process <xliff:g id="process">%1$s</xliff:g> has
has violated its self-enforced StrictMode policy.</string>
+ <!-- [CHAR LIMIT=40] Title of dialog that is shown when performing a system upgrade. -->
+ <string name="android_upgrading_title">Android is upgrading...</string>
+
+ <!-- [CHAR LIMIT=NONE] Message shown in upgrading dialog for each .apk that is optimized. -->
+ <string name="android_upgrading_apk">Optimizing application
+ <xliff:g id="number" example="123">%1$d</xliff:g> of
+ <xliff:g id="number" example="123">%2$d</xliff:g>.</string>
+
+ <!-- [CHAR LIMIT=NONE] Message to show in upgrading dialog when reached the point of starting apps. -->
+ <string name="android_upgrading_starting_apps">Starting applications.</string>
+
+ <!-- [CHAR LIMIT=NONE] Message to show in upgrading dialog when the bulk of the upgrade work is done. -->
+ <string name="android_upgrading_complete">Finishing boot.</string>
+
<!-- Notification text to tell the user that a heavy-weight application is running. -->
<string name="heavy_weight_notification"><xliff:g id="app">%1$s</xliff:g> running</string>