summaryrefslogtreecommitdiff
path: root/core/java
diff options
context:
space:
mode:
authorDianne Hackborn <hackbod@google.com>2011-08-22 00:26:20 -0700
committerDianne Hackborn <hackbod@google.com>2011-08-22 13:42:05 -0700
commit661cd52e0e1d527132eb1cae604d3e64da7ec0cb (patch)
tree3b9f7d3c75c9e28b96e8a8d961ef8fbee1fdae7b /core/java
parent5e82bc038385edcb669b44659401fb83dab9c880 (diff)
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
Diffstat (limited to 'core/java')
-rw-r--r--core/java/android/app/ActivityManagerNative.java21
-rw-r--r--core/java/android/app/IActivityManager.java3
-rw-r--r--core/java/android/content/pm/IPackageManager.aidl8
-rw-r--r--core/java/android/database/sqlite/SQLiteOpenHelper.java8
-rw-r--r--core/java/android/view/Window.java23
-rw-r--r--core/java/android/view/WindowManagerPolicy.java10
6 files changed, 72 insertions, 1 deletions
diff --git a/core/java/android/app/ActivityManagerNative.java b/core/java/android/app/ActivityManagerNative.java
index 8901fc8c5b10..77997796a8f7 100644
--- a/core/java/android/app/ActivityManagerNative.java
+++ b/core/java/android/app/ActivityManagerNative.java
@@ -1541,6 +1541,15 @@ public abstract class ActivityManagerNative extends Binder implements IActivityM
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 @@ class ActivityManagerProxy implements IActivityManager
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 49f84497fa73..27dd6916af18 100644
--- a/core/java/android/app/IActivityManager.java
+++ b/core/java/android/app/IActivityManager.java
@@ -370,6 +370,8 @@ public interface IActivityManager extends IInterface {
public long[] getProcessPss(int[] pids) throws RemoteException;
+ public void showBootMessage(CharSequence msg, boolean always) throws RemoteException;
+
/*
* Private non-Binder interfaces
*/
@@ -599,4 +601,5 @@ public interface IActivityManager extends IInterface {
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 d7607e33d2d9..08aef16eb69c 100644
--- a/core/java/android/content/pm/IPackageManager.aidl
+++ b/core/java/android/content/pm/IPackageManager.aidl
@@ -320,7 +320,13 @@ interface IPackageManager {
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 e2befca4a2c2..56cf94832cda 100644
--- a/core/java/android/database/sqlite/SQLiteOpenHelper.java
+++ b/core/java/android/database/sqlite/SQLiteOpenHelper.java
@@ -100,6 +100,14 @@ public abstract class SQLiteOpenHelper {
}
/**
+ * 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 e0e1a1a83b91..75c75927a769 100644
--- a/core/java/android/view/Window.java
+++ b/core/java/android/view/Window.java
@@ -127,6 +127,7 @@ public abstract class Window {
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 @@ public abstract class Window {
}
/**
+ * 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 @@ public abstract class Window {
}
}
+ /** @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 8a30c7b7a02f..1b4edf12ac09 100644
--- a/core/java/android/view/WindowManagerPolicy.java
+++ b/core/java/android/view/WindowManagerPolicy.java
@@ -871,6 +871,16 @@ public interface WindowManagerPolicy {
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.
*/