summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorAlexander Martinz <eviscerationls@gmail.com>2016-07-28 13:57:44 +0200
committerGerrit Code Review <gerrit@cyanogenmod.org>2016-08-10 16:57:05 -0700
commit59350eaf491df7cac496a38443e9d3fb8b715137 (patch)
treee59e894e2c9d7f6c947872d5bfb2adeb197d7187 /services
parent32265aeedd523b5568e948f918d1c689ef92d82e (diff)
downloadframeworks_base-59350eaf491df7cac496a38443e9d3fb8b715137.zip
frameworks_base-59350eaf491df7cac496a38443e9d3fb8b715137.tar.gz
frameworks_base-59350eaf491df7cac496a38443e9d3fb8b715137.tar.bz2
[2/2] base: cm custom boot dexopt UI
* Pass app info and number of installed packages to boot message UI * Ui by Asher and Joey, based on Alexander's previous work Change-Id: I9ec9d0cb0e20a9bac73e126f6b6f3965400f05e7
Diffstat (limited to 'services')
-rwxr-xr-xservices/core/java/com/android/server/am/ActivityManagerService.java16
-rw-r--r--services/core/java/com/android/server/pm/PackageManagerService.java11
-rw-r--r--services/core/java/com/android/server/policy/PhoneWindowManager.java67
-rw-r--r--services/core/java/com/android/server/wm/WindowManagerService.java12
-rw-r--r--services/java/com/android/server/SystemServer.java7
5 files changed, 35 insertions, 78 deletions
diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java
index 8e89ad8..d6480f3 100755
--- a/services/core/java/com/android/server/am/ActivityManagerService.java
+++ b/services/core/java/com/android/server/am/ActivityManagerService.java
@@ -44,6 +44,7 @@ import android.app.ApplicationThreadNative;
import android.app.BroadcastOptions;
import android.app.IActivityContainer;
import android.app.IActivityContainerCallback;
+import android.app.IActivityManager;
import android.app.IAppTask;
import android.app.ITaskStackListener;
import android.app.ProfilerInfo;
@@ -6558,12 +6559,14 @@ public final class ActivityManagerService extends ActivityManagerNative
}
@Override
- public void showBootMessage(final CharSequence msg, final boolean always) {
+ public void updateBootProgress(final int stage, final ApplicationInfo optimizedApp,
+ final int currentAppPos, final int totalAppCount, final boolean always) {
if (Binder.getCallingUid() != Process.myUid()) {
// These days only the core system can call this, so apps can't get in
// the way of what we show about running them.
}
- mWindowManager.showBootMessage(msg, always);
+ mWindowManager.updateBootProgress(stage, optimizedApp,
+ currentAppPos, totalAppCount, always);
}
@Override
@@ -11985,8 +11988,8 @@ public final class ActivityManagerService extends ActivityManagerNative
intent.setComponent(comp);
doneReceivers.add(comp);
lastRi = curRi;
- CharSequence label = ai.loadLabel(mContext.getPackageManager());
- showBootMessage(mContext.getString(R.string.android_preparing_apk, label), false);
+ updateBootProgress(IActivityManager.BOOT_STAGE_PREPARING_APPS,
+ ai.applicationInfo, 0, 0, false);
}
Slog.i(TAG, "Pre-boot of " + intent.getComponent().toShortString()
+ " for user " + users[curUser]);
@@ -12109,9 +12112,8 @@ public final class ActivityManagerService extends ActivityManagerNative
synchronized (ActivityManagerService.this) {
mDidUpdate = true;
}
- showBootMessage(mContext.getText(
- R.string.android_upgrading_complete),
- false);
+ updateBootProgress(IActivityManager.BOOT_STAGE_COMPLETE,
+ null, 0, 0, false);
writeLastDonePreBootReceivers(doneReceivers);
systemReady(goingCallback);
}
diff --git a/services/core/java/com/android/server/pm/PackageManagerService.java b/services/core/java/com/android/server/pm/PackageManagerService.java
index 02f8bbc..687ca5b 100644
--- a/services/core/java/com/android/server/pm/PackageManagerService.java
+++ b/services/core/java/com/android/server/pm/PackageManagerService.java
@@ -6364,9 +6364,8 @@ public class PackageManagerService extends IPackageManager.Stub {
if (doTrim) {
if (!isFirstBoot()) {
try {
- ActivityManagerNative.getDefault().showBootMessage(
- mContext.getResources().getString(
- R.string.android_upgrading_fstrim), true);
+ ActivityManagerNative.getDefault().updateBootProgress(
+ IActivityManager.BOOT_STAGE_FSTRIM, null, 0, 0, true);
} catch (RemoteException e) {
}
}
@@ -6493,9 +6492,9 @@ public class PackageManagerService extends IPackageManager.Stub {
Log.i(TAG, "Optimizing app " + curr + " of " + total + ": " + pkg.packageName);
}
try {
- ActivityManagerNative.getDefault().showBootMessage(
- mContext.getResources().getString(R.string.android_upgrading_apk,
- curr, total), true);
+ ActivityManagerNative.getDefault().updateBootProgress(
+ IActivityManager.BOOT_STAGE_PREPARING_APPS,
+ pkg.applicationInfo, curr, total, true);
} catch (RemoteException e) {
}
PackageParser.Package p = pkg;
diff --git a/services/core/java/com/android/server/policy/PhoneWindowManager.java b/services/core/java/com/android/server/policy/PhoneWindowManager.java
index 8a29a30..f2d44ab 100644
--- a/services/core/java/com/android/server/policy/PhoneWindowManager.java
+++ b/services/core/java/com/android/server/policy/PhoneWindowManager.java
@@ -22,8 +22,6 @@ import android.app.ActivityManagerInternal.SleepToken;
import android.app.ActivityManagerNative;
import android.app.AppOpsManager;
import android.app.IUiModeManager;
-import android.app.KeyguardManager;
-import android.app.ProgressDialog;
import android.app.SearchManager;
import android.app.StatusBarManager;
import android.app.UiModeManager;
@@ -37,6 +35,7 @@ import android.content.Intent;
import android.content.IntentFilter;
import android.content.ServiceConnection;
import android.content.pm.ActivityInfo;
+import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.content.res.CompatibilityInfo;
@@ -138,6 +137,8 @@ import com.android.server.LocalServices;
import com.android.server.policy.keyguard.KeyguardServiceDelegate;
import com.android.server.policy.keyguard.KeyguardServiceDelegate.DrawnListener;
+import org.cyanogenmod.internal.BootDexoptDialog;
+
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
@@ -7014,68 +7015,18 @@ public class PhoneWindowManager implements WindowManagerPolicy {
screenTurnedOn();
}
- ProgressDialog mBootMsgDialog = null;
+ BootDexoptDialog mBootMsgDialog = null;
/** {@inheritDoc} */
@Override
- public void showBootMessage(final CharSequence msg, final boolean always) {
+ public void updateBootProgress(final int stage, final ApplicationInfo optimizedApp,
+ final int currentAppPos, final int totalAppCount) {
mHandler.post(new Runnable() {
@Override public void run() {
if (mBootMsgDialog == null) {
- int theme;
- if (mContext.getPackageManager().hasSystemFeature(
- PackageManager.FEATURE_WATCH)) {
- theme = com.android.internal.R.style.Theme_Micro_Dialog_Alert;
- } else if (mContext.getPackageManager().hasSystemFeature(
- PackageManager.FEATURE_TELEVISION)) {
- theme = com.android.internal.R.style.Theme_Leanback_Dialog_Alert;
- } else {
- theme = 0;
- }
-
- mBootMsgDialog = new ProgressDialog(mContext, theme) {
- // This dialog will consume all events coming in to
- // it, to avoid it trying to do things too early in boot.
- @Override public boolean dispatchKeyEvent(KeyEvent event) {
- return true;
- }
- @Override public boolean dispatchKeyShortcutEvent(KeyEvent event) {
- return true;
- }
- @Override public boolean dispatchTouchEvent(MotionEvent ev) {
- return true;
- }
- @Override public boolean dispatchTrackballEvent(MotionEvent ev) {
- return true;
- }
- @Override public boolean dispatchGenericMotionEvent(MotionEvent ev) {
- return true;
- }
- @Override public boolean dispatchPopulateAccessibilityEvent(
- AccessibilityEvent event) {
- return true;
- }
- };
- 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(
- WindowManager.LayoutParams.TYPE_BOOT_PROGRESS);
- mBootMsgDialog.getWindow().addFlags(
- WindowManager.LayoutParams.FLAG_DIM_BEHIND
- | WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN);
- mBootMsgDialog.getWindow().setDimAmount(1);
- WindowManager.LayoutParams lp = mBootMsgDialog.getWindow().getAttributes();
- lp.screenOrientation = ActivityInfo.SCREEN_ORIENTATION_NOSENSOR;
- mBootMsgDialog.getWindow().setAttributes(lp);
- mBootMsgDialog.setCancelable(false);
- mBootMsgDialog.show();
- }
- mBootMsgDialog.setMessage(msg);
+ mBootMsgDialog = BootDexoptDialog.create(mContext);
+ }
+ mBootMsgDialog.setProgress(stage, optimizedApp, currentAppPos, totalAppCount);
}
});
}
diff --git a/services/core/java/com/android/server/wm/WindowManagerService.java b/services/core/java/com/android/server/wm/WindowManagerService.java
index 5c22d8b..b1337e5 100644
--- a/services/core/java/com/android/server/wm/WindowManagerService.java
+++ b/services/core/java/com/android/server/wm/WindowManagerService.java
@@ -29,6 +29,7 @@ import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.pm.ActivityInfo;
+import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.content.res.CompatibilityInfo;
import android.content.res.Configuration;
@@ -5959,13 +5960,18 @@ public class WindowManagerService extends IWindowManager.Stub
return true;
}
- public void showBootMessage(final CharSequence msg, final boolean always) {
+ public void updateBootProgress(final int stage, final ApplicationInfo optimizedApp,
+ final int currentAppPos, final int totalAppCount, final boolean always) {
boolean first = false;
synchronized(mWindowMap) {
if (DEBUG_BOOT) {
RuntimeException here = new RuntimeException("here");
here.fillInStackTrace();
- Slog.i(TAG, "showBootMessage: msg=" + msg + " always=" + always
+ Slog.i(TAG, "updateBootProgress: stage=" + stage
+ + " optimizedApp=" + optimizedApp
+ + " currentAppPos=" + currentAppPos
+ + " totalAppCount=" + totalAppCount
+ + " always=" + always
+ " mAllowBootMessages=" + mAllowBootMessages
+ " mShowingBootMessages=" + mShowingBootMessages
+ " mSystemBooted=" + mSystemBooted, here);
@@ -5983,7 +5989,7 @@ public class WindowManagerService extends IWindowManager.Stub
return;
}
mShowingBootMessages = true;
- mPolicy.showBootMessage(msg, always);
+ mPolicy.updateBootProgress(stage, optimizedApp, currentAppPos, totalAppCount);
}
if (first) {
performEnableScreen();
diff --git a/services/java/com/android/server/SystemServer.java b/services/java/com/android/server/SystemServer.java
index 953eaae..d19f8ac 100644
--- a/services/java/com/android/server/SystemServer.java
+++ b/services/java/com/android/server/SystemServer.java
@@ -18,6 +18,7 @@ package com.android.server;
import android.app.ActivityManagerNative;
import android.app.ActivityThread;
+import android.app.IActivityManager;
import android.app.IAlarmManager;
import android.app.INotificationManager;
import android.app.usage.UsageStatsManagerInternal;
@@ -620,10 +621,8 @@ public final class SystemServer {
}
try {
- ActivityManagerNative.getDefault().showBootMessage(
- context.getResources().getText(
- com.android.internal.R.string.android_upgrading_starting_apps),
- false);
+ ActivityManagerNative.getDefault().updateBootProgress(
+ IActivityManager.BOOT_STAGE_STARTING_APPS, null, 0, 0, false);
} catch (RemoteException e) {
}