diff --git a/api/current.txt b/api/current.txt
index cd85eea7db6e5..8a643fd6dcd55 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -7205,6 +7205,7 @@ package android.database.sqlite {
ctor public SQLiteOpenHelper(android.content.Context, java.lang.String, android.database.sqlite.SQLiteDatabase.CursorFactory, int);
ctor public SQLiteOpenHelper(android.content.Context, java.lang.String, android.database.sqlite.SQLiteDatabase.CursorFactory, int, android.database.DatabaseErrorHandler);
method public synchronized void close();
+ method public java.lang.String getDatabaseName();
method public synchronized android.database.sqlite.SQLiteDatabase getReadableDatabase();
method public synchronized android.database.sqlite.SQLiteDatabase getWritableDatabase();
method public abstract void onCreate(android.database.sqlite.SQLiteDatabase);
@@ -23503,6 +23504,7 @@ package android.view {
method public abstract void setContentView(android.view.View);
method public abstract void setContentView(android.view.View, android.view.ViewGroup.LayoutParams);
method protected void setDefaultWindowFormat(int);
+ method public void setDimAmount(float);
method public abstract void setFeatureDrawable(int, android.graphics.drawable.Drawable);
method public abstract void setFeatureDrawableAlpha(int, int);
method public abstract void setFeatureDrawableResource(int, int);
diff --git a/core/java/android/app/ActivityManagerNative.java b/core/java/android/app/ActivityManagerNative.java
index 8901fc8c5b106..77997796a8f77 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 49f84497fa736..27dd6916af18b 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 d7607e33d2d95..08aef16eb69cb 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 e2befca4a2c20..56cf94832cda9 100644
--- a/core/java/android/database/sqlite/SQLiteOpenHelper.java
+++ b/core/java/android/database/sqlite/SQLiteOpenHelper.java
@@ -99,6 +99,14 @@ public abstract class SQLiteOpenHelper {
mErrorHandler = errorHandler;
}
+ /**
+ * 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
diff --git a/core/java/android/view/Window.java b/core/java/android/view/Window.java
index e0e1a1a83b916..75c75927a7699 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;
@@ -744,6 +745,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. PLEASE NOTE: the
* layout params you give here should generally be from values previously
@@ -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 8a30c7b7a02f0..1b4edf12ac09f 100644
--- a/core/java/android/view/WindowManagerPolicy.java
+++ b/core/java/android/view/WindowManagerPolicy.java
@@ -870,6 +870,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.
diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml
index 27fa8d46ff58a..c80923d212462 100755
--- a/core/res/res/values/strings.xml
+++ b/core/res/res/values/strings.xml
@@ -2571,6 +2571,20 @@
The process %1$s has
has violated its self-enforced StrictMode policy.
+
+ Android is upgrading...
+
+
+ Optimizing application
+ %1$d of
+ %2$d.
+
+
+ Starting applications.
+
+
+ Finishing boot.
+
%1$s running
diff --git a/policy/src/com/android/internal/policy/impl/KeyguardViewMediator.java b/policy/src/com/android/internal/policy/impl/KeyguardViewMediator.java
index 86de5588593ba..431f8e0bf1150 100644
--- a/policy/src/com/android/internal/policy/impl/KeyguardViewMediator.java
+++ b/policy/src/com/android/internal/policy/impl/KeyguardViewMediator.java
@@ -292,7 +292,8 @@ public class KeyguardViewMediator implements KeyguardViewCallback,
mKeyguardViewProperties, mUpdateMonitor);
mUserPresentIntent = new Intent(Intent.ACTION_USER_PRESENT);
- mUserPresentIntent.addFlags(Intent.FLAG_RECEIVER_REPLACE_PENDING);
+ mUserPresentIntent.addFlags(Intent.FLAG_RECEIVER_REPLACE_PENDING
+ | Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT);
final ContentResolver cr = mContext.getContentResolver();
mShowLockIcon = (Settings.System.getInt(cr, "show_status_bar_lock", 0) == 1);
diff --git a/policy/src/com/android/internal/policy/impl/PhoneWindow.java b/policy/src/com/android/internal/policy/impl/PhoneWindow.java
index c929bbc92b324..431a6bb6b9e85 100644
--- a/policy/src/com/android/internal/policy/impl/PhoneWindow.java
+++ b/policy/src/com/android/internal/policy/impl/PhoneWindow.java
@@ -2540,8 +2540,10 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
if ((getForcedWindowFlags()&WindowManager.LayoutParams.FLAG_DIM_BEHIND) == 0) {
params.flags |= WindowManager.LayoutParams.FLAG_DIM_BEHIND;
}
- params.dimAmount = a.getFloat(
- android.R.styleable.Window_backgroundDimAmount, 0.5f);
+ if (!haveDimAmount()) {
+ params.dimAmount = a.getFloat(
+ android.R.styleable.Window_backgroundDimAmount, 0.5f);
+ }
}
if (params.windowAnimations == 0) {
diff --git a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
index e80fe302c794c..1871d68ec8b34 100755
--- a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
+++ b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
@@ -20,6 +20,7 @@ import android.app.Activity;
import android.app.ActivityManagerNative;
import android.app.IActivityManager;
import android.app.IUiModeManager;
+import android.app.ProgressDialog;
import android.app.UiModeManager;
import android.content.ActivityNotFoundException;
import android.content.BroadcastReceiver;
@@ -3098,7 +3099,44 @@ public class PhoneWindowManager implements WindowManagerPolicy {
});
}
}
-
+
+ ProgressDialog mBootMsgDialog = null;
+
+ /** {@inheritDoc} */
+ public void showBootMessage(final CharSequence msg, final boolean always) {
+ mHandler.post(new Runnable() {
+ @Override public void run() {
+ if (mBootMsgDialog == null) {
+ mBootMsgDialog = new ProgressDialog(mContext);
+ mBootMsgDialog.setTitle(R.string.android_upgrading_title);
+ mBootMsgDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
+ mBootMsgDialog.setIndeterminate(true);
+ mBootMsgDialog.getWindow().setType(
+ WindowManager.LayoutParams.TYPE_SECURE_SYSTEM_OVERLAY);
+ mBootMsgDialog.getWindow().addFlags(
+ WindowManager.LayoutParams.FLAG_DIM_BEHIND
+ | WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN);
+ mBootMsgDialog.getWindow().setDimAmount(1);
+ mBootMsgDialog.setCancelable(false);
+ mBootMsgDialog.show();
+ }
+ mBootMsgDialog.setMessage(msg);
+ }
+ });
+ }
+
+ /** {@inheritDoc} */
+ public void hideBootMessages() {
+ mHandler.post(new Runnable() {
+ @Override public void run() {
+ if (mBootMsgDialog != null) {
+ mBootMsgDialog.dismiss();
+ mBootMsgDialog = null;
+ }
+ }
+ });
+ }
+
/** {@inheritDoc} */
public void userActivity() {
synchronized (mScreenLockTimeout) {
diff --git a/services/java/com/android/server/DropBoxManagerService.java b/services/java/com/android/server/DropBoxManagerService.java
index 5c878c946231a..d37c9ab14b776 100644
--- a/services/java/com/android/server/DropBoxManagerService.java
+++ b/services/java/com/android/server/DropBoxManagerService.java
@@ -28,7 +28,6 @@ import android.os.Debug;
import android.os.DropBoxManager;
import android.os.FileUtils;
import android.os.Handler;
-import android.os.ParcelFileDescriptor;
import android.os.StatFs;
import android.os.SystemClock;
import android.provider.Settings;
@@ -45,14 +44,9 @@ import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
-import java.io.OutputStreamWriter;
import java.io.PrintWriter;
-import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
-import java.util.Comparator;
import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
import java.util.SortedSet;
import java.util.TreeSet;
import java.util.zip.GZIPOutputStream;
diff --git a/services/java/com/android/server/InputMethodManagerService.java b/services/java/com/android/server/InputMethodManagerService.java
index 73d790a073c02..6b64dd0fc0ee5 100644
--- a/services/java/com/android/server/InputMethodManagerService.java
+++ b/services/java/com/android/server/InputMethodManagerService.java
@@ -1,5 +1,4 @@
/*
- * Copyright (C) 2006-2008 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
@@ -48,7 +47,6 @@ import android.content.Intent;
import android.content.IntentFilter;
import android.content.ServiceConnection;
import android.content.pm.ApplicationInfo;
-import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.content.pm.ResolveInfo;
@@ -57,7 +55,6 @@ import android.content.res.Configuration;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.database.ContentObserver;
-import android.graphics.BitmapFactory;
import android.inputmethodservice.InputMethodService;
import android.os.Binder;
import android.os.Environment;
@@ -98,12 +95,10 @@ import java.io.FileOutputStream;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
-import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
-import java.util.Set;
import java.util.TreeMap;
/**
@@ -147,7 +142,6 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
final Handler mHandler;
final InputMethodSettings mSettings;
final SettingsObserver mSettingsObserver;
- final StatusBarManagerService mStatusBar;
final IWindowManager mIWindowManager;
final HandlerCaller mCaller;
private final InputMethodFileManager mFileManager;
@@ -162,10 +156,11 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
new LruCache(SECURE_SUGGESTION_SPANS_MAX_SIZE);
// Ongoing notification
- private final NotificationManager mNotificationManager;
- private final KeyguardManager mKeyguardManager;
- private final Notification mImeSwitcherNotification;
- private final PendingIntent mImeSwitchPendingIntent;
+ private NotificationManager mNotificationManager;
+ private KeyguardManager mKeyguardManager;
+ private StatusBarManagerService mStatusBar;
+ private Notification mImeSwitcherNotification;
+ private PendingIntent mImeSwitchPendingIntent;
private boolean mShowOngoingImeSwitcherForPhones;
private boolean mNotificationShown;
@@ -469,8 +464,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
// Pick another one...
Slog.i(TAG, "Current input method removed: " + curInputMethodId);
mImeWindowVis = 0;
- mStatusBar.setImeWindowStatus(mCurToken, mImeWindowVis,
- mBackDisposition);
+ updateImeWindowStatusLocked();
if (!chooseNewDefaultIMELocked()) {
changed = true;
curIm = null;
@@ -511,7 +505,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
}
}
- public InputMethodManagerService(Context context, StatusBarManagerService statusBar) {
+ public InputMethodManagerService(Context context) {
mContext = context;
mRes = context.getResources();
mHandler = new Handler(this);
@@ -524,10 +518,6 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
}
});
- mKeyguardManager = (KeyguardManager)
- mContext.getSystemService(Context.KEYGUARD_SERVICE);
- mNotificationManager = (NotificationManager)
- mContext.getSystemService(Context.NOTIFICATION_SERVICE);
mImeSwitcherNotification = new Notification();
mImeSwitcherNotification.icon = com.android.internal.R.drawable.ic_notification_ime_default;
mImeSwitcherNotification.when = 0;
@@ -553,8 +543,6 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
screenOnOffFilt.addAction(Intent.ACTION_CLOSE_SYSTEM_DIALOGS);
mContext.registerReceiver(new ScreenOnOffReceiver(), screenOnOffFilt);
- mStatusBar = statusBar;
- statusBar.setIconVisibility("ime", false);
mNotificationShown = false;
// mSettings should be created before buildInputMethodListLocked
@@ -608,10 +596,17 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
}
}
- public void systemReady() {
+ public void systemReady(StatusBarManagerService statusBar) {
synchronized (mMethodMap) {
if (!mSystemReady) {
mSystemReady = true;
+ mKeyguardManager = (KeyguardManager)
+ mContext.getSystemService(Context.KEYGUARD_SERVICE);
+ mNotificationManager = (NotificationManager)
+ mContext.getSystemService(Context.NOTIFICATION_SERVICE);
+ mStatusBar = statusBar;
+ statusBar.setIconVisibility("ime", false);
+ updateImeWindowStatusLocked();
mShowOngoingImeSwitcherForPhones = mRes.getBoolean(
com.android.internal.R.bool.show_ongoing_ime_switcher);
try {
@@ -623,6 +618,13 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
}
}
+ void updateImeWindowStatusLocked() {
+ if (mStatusBar != null) {
+ mStatusBar.setImeWindowStatus(mCurToken, mImeWindowVis,
+ mBackDisposition);
+ }
+ }
+
@Override
public List getInputMethodList() {
synchronized (mMethodMap) {
@@ -1009,7 +1011,9 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
mEnabledSession = null;
mCurMethod = null;
}
- mStatusBar.setIconVisibility("ime", false);
+ if (mStatusBar != null) {
+ mStatusBar.setIconVisibility("ime", false);
+ }
}
@Override
@@ -1046,7 +1050,9 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
synchronized (mMethodMap) {
if (iconId == 0) {
if (DEBUG) Slog.d(TAG, "hide the small icon for the input method");
- mStatusBar.setIconVisibility("ime", false);
+ if (mStatusBar != null) {
+ mStatusBar.setIconVisibility("ime", false);
+ }
} else if (packageName != null) {
if (DEBUG) Slog.d(TAG, "show a small icon for the input method");
CharSequence contentDescription = null;
@@ -1057,9 +1063,12 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
} catch (NameNotFoundException nnfe) {
/* ignore */
}
- mStatusBar.setIcon("ime", packageName, iconId, 0,
- contentDescription != null ? contentDescription.toString() : null);
- mStatusBar.setIconVisibility("ime", true);
+ if (mStatusBar != null) {
+ mStatusBar.setIcon("ime", packageName, iconId, 0,
+ contentDescription != null
+ ? contentDescription.toString() : null);
+ mStatusBar.setIconVisibility("ime", true);
+ }
}
}
} finally {
@@ -1125,7 +1134,9 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
synchronized (mMethodMap) {
mImeWindowVis = vis;
mBackDisposition = backDisposition;
- mStatusBar.setImeWindowStatus(token, vis, backDisposition);
+ if (mStatusBar != null) {
+ mStatusBar.setImeWindowStatus(token, vis, backDisposition);
+ }
final boolean iconVisibility = (vis & InputMethodService.IME_ACTIVE) != 0;
final InputMethodInfo imi = mMethodMap.get(mCurMethodId);
if (imi != null && iconVisibility && needsToShowImeSwitchOngoingNotification()) {
@@ -1142,12 +1153,14 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
mImeSwitcherNotification.setLatestEventInfo(
mContext, title, summary, mImeSwitchPendingIntent);
- mNotificationManager.notify(
- com.android.internal.R.string.select_input_method,
- mImeSwitcherNotification);
- mNotificationShown = true;
+ if (mNotificationManager != null) {
+ mNotificationManager.notify(
+ com.android.internal.R.string.select_input_method,
+ mImeSwitcherNotification);
+ mNotificationShown = true;
+ }
} else {
- if (mNotificationShown) {
+ if (mNotificationShown && mNotificationManager != null) {
mNotificationManager.cancel(
com.android.internal.R.string.select_input_method);
mNotificationShown = false;
@@ -1252,8 +1265,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
mImeWindowVis = (mInputShown || hardKeyShown) ? (
InputMethodService.IME_ACTIVE | InputMethodService.IME_VISIBLE)
: 0;
- mStatusBar.setImeWindowStatus(mCurToken, mImeWindowVis,
- mBackDisposition);
+ updateImeWindowStatusLocked();
// If subtype is null, try to find the most applicable one from
// getCurrentInputMethodSubtype.
if (subtype == null) {
@@ -1374,13 +1386,12 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
if (DEBUG) Slog.w(TAG, "Ignoring hideSoftInput of uid "
+ uid + ": " + client);
mImeWindowVis = 0;
- mStatusBar.setImeWindowStatus(mCurToken, mImeWindowVis,
- mBackDisposition);
+ updateImeWindowStatusLocked();
return false;
}
} catch (RemoteException e) {
mImeWindowVis = 0;
- mStatusBar.setImeWindowStatus(mCurToken, mImeWindowVis, mBackDisposition);
+ updateImeWindowStatusLocked();
return false;
}
}
@@ -2151,7 +2162,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
}
});
- if (showSubtypes && !(mKeyguardManager.isKeyguardLocked()
+ if (showSubtypes && mKeyguardManager != null && !(mKeyguardManager.isKeyguardLocked()
&& mKeyguardManager.isKeyguardSecure())) {
mDialogBuilder.setPositiveButton(
com.android.internal.R.string.configure_input_methods,
diff --git a/services/java/com/android/server/SystemServer.java b/services/java/com/android/server/SystemServer.java
index 1c6c35590dc89..858f16589ac13 100644
--- a/services/java/com/android/server/SystemServer.java
+++ b/services/java/com/android/server/SystemServer.java
@@ -40,6 +40,7 @@ import android.server.BluetoothService;
import android.server.search.SearchManagerService;
import android.util.DisplayMetrics;
import android.util.EventLog;
+import android.util.Log;
import android.util.Slog;
import android.view.WindowManager;
@@ -66,6 +67,11 @@ class ServerThread extends Thread {
ContentResolver mContentResolver;
+ void reportWtf(String msg, Throwable e) {
+ Slog.w(TAG, "***********************************************");
+ Log.wtf(TAG, "BOOT FAILURE " + msg, e);
+ }
+
@Override
public void run() {
EventLog.writeEvent(EventLogTags.BOOT_PROGRESS_SYSTEM_RUN,
@@ -117,7 +123,6 @@ class ServerThread extends Thread {
WindowManagerService wm = null;
BluetoothService bluetooth = null;
BluetoothA2dpService bluetoothA2dp = null;
- WiredAccessoryObserver wiredAccessory = null;
DockObserver dock = null;
UsbService usb = null;
UiModeManagerService uiMode = null;
@@ -223,7 +228,8 @@ class ServerThread extends Thread {
}
} catch (RuntimeException e) {
- Slog.e("System", "Failure starting core service", e);
+ Slog.e("System", "******************************************");
+ Slog.e("System", "************ Failure starting core service", e);
}
DevicePolicyManagerService devicePolicy = null;
@@ -236,13 +242,52 @@ class ServerThread extends Thread {
CountryDetectorService countryDetector = null;
TextServicesManagerService tsms = null;
+ // Bring up services needed for UI.
+ if (factoryTest != SystemServer.FACTORY_TEST_LOW_LEVEL) {
+ try {
+ Slog.i(TAG, "Input Method Service");
+ imm = new InputMethodManagerService(context);
+ ServiceManager.addService(Context.INPUT_METHOD_SERVICE, imm);
+ } catch (Throwable e) {
+ reportWtf("starting Input Manager Service", e);
+ }
+
+ try {
+ Slog.i(TAG, "Accessibility Manager");
+ ServiceManager.addService(Context.ACCESSIBILITY_SERVICE,
+ new AccessibilityManagerService(context));
+ } catch (Throwable e) {
+ reportWtf("starting Accessibility Manager", e);
+ }
+ }
+
+ try {
+ wm.displayReady();
+ } catch (Throwable e) {
+ reportWtf("making display ready", e);
+ }
+
+ try {
+ pm.performBootDexOpt();
+ } catch (Throwable e) {
+ reportWtf("performing boot dexopt", e);
+ }
+
+ try {
+ ActivityManagerNative.getDefault().showBootMessage(
+ context.getResources().getText(
+ com.android.internal.R.string.android_upgrading_starting_apps),
+ false);
+ } catch (RemoteException e) {
+ }
+
if (factoryTest != SystemServer.FACTORY_TEST_LOW_LEVEL) {
try {
Slog.i(TAG, "Device Policy");
devicePolicy = new DevicePolicyManagerService(context);
ServiceManager.addService(Context.DEVICE_POLICY_SERVICE, devicePolicy);
} catch (Throwable e) {
- Slog.e(TAG, "Failure starting DevicePolicyService", e);
+ reportWtf("starting DevicePolicyService", e);
}
try {
@@ -250,7 +295,7 @@ class ServerThread extends Thread {
statusBar = new StatusBarManagerService(context, wm);
ServiceManager.addService(Context.STATUS_BAR_SERVICE, statusBar);
} catch (Throwable e) {
- Slog.e(TAG, "Failure starting StatusBarManagerService", e);
+ reportWtf("starting StatusBarManagerService", e);
}
try {
@@ -258,15 +303,7 @@ class ServerThread extends Thread {
ServiceManager.addService(Context.CLIPBOARD_SERVICE,
new ClipboardService(context));
} catch (Throwable e) {
- Slog.e(TAG, "Failure starting Clipboard Service", e);
- }
-
- try {
- Slog.i(TAG, "Input Method Service");
- imm = new InputMethodManagerService(context, statusBar);
- ServiceManager.addService(Context.INPUT_METHOD_SERVICE, imm);
- } catch (Throwable e) {
- Slog.e(TAG, "Failure starting Input Manager Service", e);
+ reportWtf("starting Clipboard Service", e);
}
try {
@@ -274,7 +311,7 @@ class ServerThread extends Thread {
networkManagement = NetworkManagementService.create(context);
ServiceManager.addService(Context.NETWORKMANAGEMENT_SERVICE, networkManagement);
} catch (Throwable e) {
- Slog.e(TAG, "Failure starting NetworkManagement Service", e);
+ reportWtf("starting NetworkManagement Service", e);
}
try {
@@ -282,7 +319,7 @@ class ServerThread extends Thread {
tsms = new TextServicesManagerService(context);
ServiceManager.addService(Context.TEXT_SERVICES_MANAGER_SERVICE, tsms);
} catch (Throwable e) {
- Slog.e(TAG, "Failure starting Text Service Manager Service", e);
+ reportWtf("starting Text Service Manager Service", e);
}
try {
@@ -290,7 +327,7 @@ class ServerThread extends Thread {
networkStats = new NetworkStatsService(context, networkManagement, alarm);
ServiceManager.addService(Context.NETWORK_STATS_SERVICE, networkStats);
} catch (Throwable e) {
- Slog.e(TAG, "Failure starting NetworkStats Service", e);
+ reportWtf("starting NetworkStats Service", e);
}
try {
@@ -300,7 +337,7 @@ class ServerThread extends Thread {
networkStats, networkManagement);
ServiceManager.addService(Context.NETWORK_POLICY_SERVICE, networkPolicy);
} catch (Throwable e) {
- Slog.e(TAG, "Failure starting NetworkPolicy Service", e);
+ reportWtf("starting NetworkPolicy Service", e);
}
try {
@@ -308,7 +345,7 @@ class ServerThread extends Thread {
wifiP2p = new WifiP2pService(context);
ServiceManager.addService(Context.WIFI_P2P_SERVICE, wifiP2p);
} catch (Throwable e) {
- Slog.e(TAG, "Failure starting Wi-Fi P2pService", e);
+ reportWtf("starting Wi-Fi P2pService", e);
}
try {
@@ -317,7 +354,7 @@ class ServerThread extends Thread {
ServiceManager.addService(Context.WIFI_SERVICE, wifi);
wifi.checkAndStartWifi();
} catch (Throwable e) {
- Slog.e(TAG, "Failure starting Wi-Fi Service", e);
+ reportWtf("starting Wi-Fi Service", e);
}
try {
@@ -328,7 +365,7 @@ class ServerThread extends Thread {
networkPolicy.bindConnectivityManager(connectivity);
wifiP2p.connectivityServiceReady();
} catch (Throwable e) {
- Slog.e(TAG, "Failure starting Connectivity Service", e);
+ reportWtf("starting Connectivity Service", e);
}
try {
@@ -337,15 +374,7 @@ class ServerThread extends Thread {
ServiceManager.addService(
Context.THROTTLE_SERVICE, throttle);
} catch (Throwable e) {
- Slog.e(TAG, "Failure starting ThrottleService", e);
- }
-
- try {
- Slog.i(TAG, "Accessibility Manager");
- ServiceManager.addService(Context.ACCESSIBILITY_SERVICE,
- new AccessibilityManagerService(context));
- } catch (Throwable e) {
- Slog.e(TAG, "Failure starting Accessibility Manager", e);
+ reportWtf("starting ThrottleService", e);
}
if (!"0".equals(SystemProperties.get("system_init.startmountservice"))) {
@@ -357,7 +386,7 @@ class ServerThread extends Thread {
Slog.i(TAG, "Mount Service");
ServiceManager.addService("mount", new MountService(context));
} catch (Throwable e) {
- Slog.e(TAG, "Failure starting Mount Service", e);
+ reportWtf("starting Mount Service", e);
}
}
@@ -367,7 +396,7 @@ class ServerThread extends Thread {
ServiceManager.addService(Context.NOTIFICATION_SERVICE, notification);
networkPolicy.bindNotificationManager(notification);
} catch (Throwable e) {
- Slog.e(TAG, "Failure starting Notification Manager", e);
+ reportWtf("starting Notification Manager", e);
}
try {
@@ -375,7 +404,7 @@ class ServerThread extends Thread {
ServiceManager.addService(DeviceStorageMonitorService.SERVICE,
new DeviceStorageMonitorService(context));
} catch (Throwable e) {
- Slog.e(TAG, "Failure starting DeviceStorageMonitor service", e);
+ reportWtf("starting DeviceStorageMonitor service", e);
}
try {
@@ -383,7 +412,7 @@ class ServerThread extends Thread {
location = new LocationManagerService(context);
ServiceManager.addService(Context.LOCATION_SERVICE, location);
} catch (Throwable e) {
- Slog.e(TAG, "Failure starting Location Manager", e);
+ reportWtf("starting Location Manager", e);
}
try {
@@ -391,7 +420,7 @@ class ServerThread extends Thread {
countryDetector = new CountryDetectorService(context);
ServiceManager.addService(Context.COUNTRY_DETECTOR, countryDetector);
} catch (Throwable e) {
- Slog.e(TAG, "Failure starting Country Detector", e);
+ reportWtf("starting Country Detector", e);
}
try {
@@ -399,7 +428,7 @@ class ServerThread extends Thread {
ServiceManager.addService(Context.SEARCH_SERVICE,
new SearchManagerService(context));
} catch (Throwable e) {
- Slog.e(TAG, "Failure starting Search Service", e);
+ reportWtf("starting Search Service", e);
}
try {
@@ -407,7 +436,7 @@ class ServerThread extends Thread {
ServiceManager.addService(Context.DROPBOX_SERVICE,
new DropBoxManagerService(context, new File("/data/system/dropbox")));
} catch (Throwable e) {
- Slog.e(TAG, "Failure starting DropBoxManagerService", e);
+ reportWtf("starting DropBoxManagerService", e);
}
try {
@@ -417,7 +446,7 @@ class ServerThread extends Thread {
ServiceManager.addService(Context.WALLPAPER_SERVICE, wallpaper);
}
} catch (Throwable e) {
- Slog.e(TAG, "Failure starting Wallpaper Service", e);
+ reportWtf("starting Wallpaper Service", e);
}
if (!"0".equals(SystemProperties.get("system_init.startaudioservice"))) {
@@ -425,7 +454,7 @@ class ServerThread extends Thread {
Slog.i(TAG, "Audio Service");
ServiceManager.addService(Context.AUDIO_SERVICE, new AudioService(context));
} catch (Throwable e) {
- Slog.e(TAG, "Failure starting Audio Service", e);
+ reportWtf("starting Audio Service", e);
}
}
@@ -434,15 +463,15 @@ class ServerThread extends Thread {
// Listen for dock station changes
dock = new DockObserver(context, power);
} catch (Throwable e) {
- Slog.e(TAG, "Failure starting DockObserver", e);
+ reportWtf("starting DockObserver", e);
}
try {
Slog.i(TAG, "Wired Accessory Observer");
// Listen for wired headset changes
- wiredAccessory = new WiredAccessoryObserver(context);
+ new WiredAccessoryObserver(context);
} catch (Throwable e) {
- Slog.e(TAG, "Failure starting WiredAccessoryObserver", e);
+ reportWtf("starting WiredAccessoryObserver", e);
}
try {
@@ -451,7 +480,7 @@ class ServerThread extends Thread {
usb = new UsbService(context);
ServiceManager.addService(Context.USB_SERVICE, usb);
} catch (Throwable e) {
- Slog.e(TAG, "Failure starting UsbService", e);
+ reportWtf("starting UsbService", e);
}
try {
@@ -459,7 +488,7 @@ class ServerThread extends Thread {
// Listen for UI mode changes
uiMode = new UiModeManagerService(context);
} catch (Throwable e) {
- Slog.e(TAG, "Failure starting UiModeManagerService", e);
+ reportWtf("starting UiModeManagerService", e);
}
try {
@@ -475,21 +504,21 @@ class ServerThread extends Thread {
appWidget = new AppWidgetService(context);
ServiceManager.addService(Context.APPWIDGET_SERVICE, appWidget);
} catch (Throwable e) {
- Slog.e(TAG, "Failure starting AppWidget Service", e);
+ reportWtf("starting AppWidget Service", e);
}
try {
Slog.i(TAG, "Recognition Service");
recognition = new RecognitionManagerService(context);
} catch (Throwable e) {
- Slog.e(TAG, "Failure starting Recognition Service", e);
+ reportWtf("starting Recognition Service", e);
}
try {
Slog.i(TAG, "DiskStats Service");
ServiceManager.addService("diskstats", new DiskStatsService(context));
} catch (Throwable e) {
- Slog.e(TAG, "Failure starting DiskStats Service", e);
+ reportWtf("starting DiskStats Service", e);
}
try {
@@ -501,14 +530,14 @@ class ServerThread extends Thread {
ServiceManager.addService("samplingprofiler",
new SamplingProfilerService(context));
} catch (Throwable e) {
- Slog.e(TAG, "Failure starting SamplingProfiler Service", e);
+ reportWtf("starting SamplingProfiler Service", e);
}
try {
Slog.i(TAG, "NetworkTimeUpdateService");
networkTimeUpdater = new NetworkTimeUpdateService(context);
} catch (Throwable e) {
- Slog.e(TAG, "Failure starting NetworkTimeUpdate service");
+ reportWtf("starting NetworkTimeUpdate service", e);
}
}
@@ -529,14 +558,26 @@ class ServerThread extends Thread {
// It is now time to start up the app processes...
if (devicePolicy != null) {
- devicePolicy.systemReady();
+ try {
+ devicePolicy.systemReady();
+ } catch (Throwable e) {
+ reportWtf("making Device Policy Service ready", e);
+ }
}
if (notification != null) {
- notification.systemReady();
+ try {
+ notification.systemReady();
+ } catch (Throwable e) {
+ reportWtf("making Notification Service ready", e);
+ }
}
- wm.systemReady();
+ try {
+ wm.systemReady();
+ } catch (Throwable e) {
+ reportWtf("making Window Manager Service ready", e);
+ }
if (safeMode) {
ActivityManagerService.self().showSafeModeOverlay();
@@ -554,7 +595,8 @@ class ServerThread extends Thread {
power.systemReady();
try {
pm.systemReady();
- } catch (RemoteException e) {
+ } catch (Throwable e) {
+ reportWtf("making Package Manager Service ready", e);
}
// These are needed to propagate to the runnable below.
@@ -576,6 +618,7 @@ class ServerThread extends Thread {
final CountryDetectorService countryDetectorF = countryDetector;
final NetworkTimeUpdateService networkTimeUpdaterF = networkTimeUpdater;
final TextServicesManagerService textServiceManagerServiceF = tsms;
+ final StatusBarManagerService statusBarF = statusBar;
// We now tell the activity manager it is okay to run third party
// code. It will call back into us once it has gotten to the state
@@ -588,28 +631,96 @@ class ServerThread extends Thread {
Slog.i(TAG, "Making services ready");
if (!headless) startSystemUi(contextF);
- if (batteryF != null) batteryF.systemReady();
- if (networkManagementF != null) networkManagementF.systemReady();
- if (networkStatsF != null) networkStatsF.systemReady();
- if (networkPolicyF != null) networkPolicyF.systemReady();
- if (connectivityF != null) connectivityF.systemReady();
- if (dockF != null) dockF.systemReady();
- if (usbF != null) usbF.systemReady();
- if (uiModeF != null) uiModeF.systemReady();
- if (recognitionF != null) recognitionF.systemReady();
+ try {
+ if (batteryF != null) batteryF.systemReady();
+ } catch (Throwable e) {
+ reportWtf("making Battery Service ready", e);
+ }
+ try {
+ if (networkManagementF != null) networkManagementF.systemReady();
+ } catch (Throwable e) {
+ reportWtf("making Network Managment Service ready", e);
+ }
+ try {
+ if (networkStatsF != null) networkStatsF.systemReady();
+ } catch (Throwable e) {
+ reportWtf("making Network Stats Service ready", e);
+ }
+ try {
+ if (networkPolicyF != null) networkPolicyF.systemReady();
+ } catch (Throwable e) {
+ reportWtf("making Network Policy Service ready", e);
+ }
+ try {
+ if (connectivityF != null) connectivityF.systemReady();
+ } catch (Throwable e) {
+ reportWtf("making Connectivity Service ready", e);
+ }
+ try {
+ if (dockF != null) dockF.systemReady();
+ } catch (Throwable e) {
+ reportWtf("making Dock Service ready", e);
+ }
+ try {
+ if (usbF != null) usbF.systemReady();
+ } catch (Throwable e) {
+ reportWtf("making USB Service ready", e);
+ }
+ try {
+ if (uiModeF != null) uiModeF.systemReady();
+ } catch (Throwable e) {
+ reportWtf("making UI Mode Service ready", e);
+ }
+ try {
+ if (recognitionF != null) recognitionF.systemReady();
+ } catch (Throwable e) {
+ reportWtf("making Recognition Service ready", e);
+ }
Watchdog.getInstance().start();
// It is now okay to let the various system services start their
// third party code...
- if (appWidgetF != null) appWidgetF.systemReady(safeMode);
- if (wallpaperF != null) wallpaperF.systemReady();
- if (immF != null) immF.systemReady();
- if (locationF != null) locationF.systemReady();
- if (countryDetectorF != null) countryDetectorF.systemReady();
- if (throttleF != null) throttleF.systemReady();
- if (networkTimeUpdaterF != null) networkTimeUpdaterF.systemReady();
- if (textServiceManagerServiceF != null) textServiceManagerServiceF.systemReady();
+ try {
+ if (appWidgetF != null) appWidgetF.systemReady(safeMode);
+ } catch (Throwable e) {
+ reportWtf("making App Widget Service ready", e);
+ }
+ try {
+ if (wallpaperF != null) wallpaperF.systemReady();
+ } catch (Throwable e) {
+ reportWtf("making Wallpaper Service ready", e);
+ }
+ try {
+ if (immF != null) immF.systemReady(statusBarF);
+ } catch (Throwable e) {
+ reportWtf("making Input Method Service ready", e);
+ }
+ try {
+ if (locationF != null) locationF.systemReady();
+ } catch (Throwable e) {
+ reportWtf("making Location Service ready", e);
+ }
+ try {
+ if (countryDetectorF != null) countryDetectorF.systemReady();
+ } catch (Throwable e) {
+ reportWtf("making Country Detector Service ready", e);
+ }
+ try {
+ if (throttleF != null) throttleF.systemReady();
+ } catch (Throwable e) {
+ reportWtf("making Throttle Service ready", e);
+ }
+ try {
+ if (networkTimeUpdaterF != null) networkTimeUpdaterF.systemReady();
+ } catch (Throwable e) {
+ reportWtf("making Network Time Service ready", e);
+ }
+ try {
+ if (textServiceManagerServiceF != null) textServiceManagerServiceF.systemReady();
+ } catch (Throwable e) {
+ reportWtf("making Text Services Manager Service ready", e);
+ }
}
});
diff --git a/services/java/com/android/server/am/ActivityManagerService.java b/services/java/com/android/server/am/ActivityManagerService.java
index d6a7bf9e04058..e40a8d82691f1 100644
--- a/services/java/com/android/server/am/ActivityManagerService.java
+++ b/services/java/com/android/server/am/ActivityManagerService.java
@@ -91,6 +91,7 @@ import android.os.Environment;
import android.os.FileObserver;
import android.os.FileUtils;
import android.os.Handler;
+import android.os.HandlerThread;
import android.os.IBinder;
import android.os.IPermissionController;
import android.os.Looper;
@@ -3755,6 +3756,10 @@ public final class ActivityManagerService extends ActivityManagerNative
mWindowManager.enableScreenAfterBoot();
}
+ public void showBootMessage(final CharSequence msg, final boolean always) {
+ mWindowManager.showBootMessage(msg, always);
+ }
+
final void finishBooting() {
IntentFilter pkgFilter = new IntentFilter();
pkgFilter.addAction(Intent.ACTION_QUERY_PACKAGE_RESTART);
@@ -6453,7 +6458,9 @@ public final class ActivityManagerService extends ActivityManagerNative
File fname = new File(systemDir, "called_pre_boots.dat");
return fname;
}
-
+
+ static final int LAST_DONE_VERSION = 10000;
+
private static ArrayList readLastDonePreBootReceivers() {
ArrayList lastDoneReceivers = new ArrayList();
File file = getCalledPreBootReceiversFile();
@@ -6461,16 +6468,21 @@ public final class ActivityManagerService extends ActivityManagerNative
try {
fis = new FileInputStream(file);
DataInputStream dis = new DataInputStream(new BufferedInputStream(fis, 2048));
- int vers = dis.readInt();
- String codename = dis.readUTF();
- if (vers == android.os.Build.VERSION.SDK_INT
- && codename.equals(android.os.Build.VERSION.CODENAME)) {
- int num = dis.readInt();
- while (num > 0) {
- num--;
- String pkg = dis.readUTF();
- String cls = dis.readUTF();
- lastDoneReceivers.add(new ComponentName(pkg, cls));
+ int fvers = dis.readInt();
+ if (fvers == LAST_DONE_VERSION) {
+ String vers = dis.readUTF();
+ String codename = dis.readUTF();
+ String build = dis.readUTF();
+ if (android.os.Build.VERSION.RELEASE.equals(vers)
+ && android.os.Build.VERSION.CODENAME.equals(codename)
+ && android.os.Build.VERSION.INCREMENTAL.equals(build)) {
+ int num = dis.readInt();
+ while (num > 0) {
+ num--;
+ String pkg = dis.readUTF();
+ String cls = dis.readUTF();
+ lastDoneReceivers.add(new ComponentName(pkg, cls));
+ }
}
}
} catch (FileNotFoundException e) {
@@ -6495,8 +6507,10 @@ public final class ActivityManagerService extends ActivityManagerNative
Slog.i(TAG, "Writing new set of last done pre-boot receivers...");
fos = new FileOutputStream(file);
dos = new DataOutputStream(new BufferedOutputStream(fos, 2048));
- dos.writeInt(android.os.Build.VERSION.SDK_INT);
+ dos.writeInt(LAST_DONE_VERSION);
+ dos.writeUTF(android.os.Build.VERSION.RELEASE);
dos.writeUTF(android.os.Build.VERSION.CODENAME);
+ dos.writeUTF(android.os.Build.VERSION.INCREMENTAL);
dos.writeInt(list.size());
for (int i=0; i mPendingVerification = new SparseArray();
+ final ArrayList mDeferredDexOpt =
+ new ArrayList();
+
/** Token for keys in mPendingVerification. */
private int mPendingVerificationToken = 0;
@@ -907,7 +911,7 @@ public class PackageManagerService extends IPackageManager.Stub {
// Set flag to monitor and not change apk file paths when
// scanning install directories.
- int scanMode = SCAN_MONITOR | SCAN_NO_PATHS;
+ int scanMode = SCAN_MONITOR | SCAN_NO_PATHS | SCAN_DEFER_DEX;
if (mNoDexOpt) {
Slog.w(TAG, "Running ENG build: no pre-dexopt!");
scanMode |= SCAN_NO_DEX;
@@ -2899,6 +2903,33 @@ public class PackageManagerService extends IPackageManager.Stub {
}
}
+ public void performBootDexOpt() {
+ ArrayList pkgs = null;
+ synchronized (mPackages) {
+ if (mDeferredDexOpt.size() > 0) {
+ pkgs = new ArrayList(mDeferredDexOpt);
+ mDeferredDexOpt.clear();
+ }
+ }
+ if (pkgs != null) {
+ for (int i=0; i