|
22 | 22 | import android.app.ActivityManagerNative; |
23 | 23 | import android.app.AppOpsManager; |
24 | 24 | import android.app.IUiModeManager; |
25 | | -import android.app.ProgressDialog; |
26 | 25 | import android.app.SearchManager; |
27 | 26 | import android.app.StatusBarManager; |
28 | 27 | import android.app.UiModeManager; |
|
36 | 35 | import android.content.IntentFilter; |
37 | 36 | import android.content.ServiceConnection; |
38 | 37 | import android.content.pm.ActivityInfo; |
| 38 | +import android.content.pm.ApplicationInfo; |
39 | 39 | import android.content.pm.PackageManager; |
40 | 40 | import android.content.pm.ResolveInfo; |
41 | 41 | import android.content.res.CompatibilityInfo; |
|
144 | 144 | import com.android.server.policy.keyguard.KeyguardServiceDelegate; |
145 | 145 | import com.android.server.policy.keyguard.KeyguardServiceDelegate.DrawnListener; |
146 | 146 |
|
| 147 | +import org.cyanogenmod.internal.BootDexoptDialog; |
| 148 | + |
147 | 149 | import java.io.File; |
148 | 150 | import java.io.FileReader; |
149 | 151 | import java.io.IOException; |
@@ -7397,68 +7399,18 @@ public void systemBooted() { |
7397 | 7399 | screenTurnedOn(); |
7398 | 7400 | } |
7399 | 7401 |
|
7400 | | - ProgressDialog mBootMsgDialog = null; |
| 7402 | + BootDexoptDialog mBootMsgDialog = null; |
7401 | 7403 |
|
7402 | 7404 | /** {@inheritDoc} */ |
7403 | 7405 | @Override |
7404 | | - public void showBootMessage(final CharSequence msg, final boolean always) { |
| 7406 | + public void updateBootProgress(final int stage, final ApplicationInfo optimizedApp, |
| 7407 | + final int currentAppPos, final int totalAppCount) { |
7405 | 7408 | mHandler.post(new Runnable() { |
7406 | 7409 | @Override public void run() { |
7407 | 7410 | if (mBootMsgDialog == null) { |
7408 | | - int theme; |
7409 | | - if (mContext.getPackageManager().hasSystemFeature( |
7410 | | - PackageManager.FEATURE_WATCH)) { |
7411 | | - theme = com.android.internal.R.style.Theme_Micro_Dialog_Alert; |
7412 | | - } else if (mContext.getPackageManager().hasSystemFeature( |
7413 | | - PackageManager.FEATURE_TELEVISION)) { |
7414 | | - theme = com.android.internal.R.style.Theme_Leanback_Dialog_Alert; |
7415 | | - } else { |
7416 | | - theme = 0; |
7417 | | - } |
7418 | | - |
7419 | | - mBootMsgDialog = new ProgressDialog(mContext, theme) { |
7420 | | - // This dialog will consume all events coming in to |
7421 | | - // it, to avoid it trying to do things too early in boot. |
7422 | | - @Override public boolean dispatchKeyEvent(KeyEvent event) { |
7423 | | - return true; |
7424 | | - } |
7425 | | - @Override public boolean dispatchKeyShortcutEvent(KeyEvent event) { |
7426 | | - return true; |
7427 | | - } |
7428 | | - @Override public boolean dispatchTouchEvent(MotionEvent ev) { |
7429 | | - return true; |
7430 | | - } |
7431 | | - @Override public boolean dispatchTrackballEvent(MotionEvent ev) { |
7432 | | - return true; |
7433 | | - } |
7434 | | - @Override public boolean dispatchGenericMotionEvent(MotionEvent ev) { |
7435 | | - return true; |
7436 | | - } |
7437 | | - @Override public boolean dispatchPopulateAccessibilityEvent( |
7438 | | - AccessibilityEvent event) { |
7439 | | - return true; |
7440 | | - } |
7441 | | - }; |
7442 | | - if (mContext.getPackageManager().isUpgrade()) { |
7443 | | - mBootMsgDialog.setTitle(R.string.android_upgrading_title); |
7444 | | - } else { |
7445 | | - mBootMsgDialog.setTitle(R.string.android_start_title); |
7446 | | - } |
7447 | | - mBootMsgDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER); |
7448 | | - mBootMsgDialog.setIndeterminate(true); |
7449 | | - mBootMsgDialog.getWindow().setType( |
7450 | | - WindowManager.LayoutParams.TYPE_BOOT_PROGRESS); |
7451 | | - mBootMsgDialog.getWindow().addFlags( |
7452 | | - WindowManager.LayoutParams.FLAG_DIM_BEHIND |
7453 | | - | WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN); |
7454 | | - mBootMsgDialog.getWindow().setDimAmount(1); |
7455 | | - WindowManager.LayoutParams lp = mBootMsgDialog.getWindow().getAttributes(); |
7456 | | - lp.screenOrientation = ActivityInfo.SCREEN_ORIENTATION_NOSENSOR; |
7457 | | - mBootMsgDialog.getWindow().setAttributes(lp); |
7458 | | - mBootMsgDialog.setCancelable(false); |
7459 | | - mBootMsgDialog.show(); |
7460 | | - } |
7461 | | - mBootMsgDialog.setMessage(msg); |
| 7411 | + mBootMsgDialog = BootDexoptDialog.create(mContext); |
| 7412 | + } |
| 7413 | + mBootMsgDialog.setProgress(stage, optimizedApp, currentAppPos, totalAppCount); |
7462 | 7414 | } |
7463 | 7415 | }); |
7464 | 7416 | } |
|
0 commit comments