Merge changes I955f9dfa,Ibfbb9d67 into nyc-mr1-dev

* changes:
  Only show optimizing storage dialog if dex opt dialog was shown
  Only do slow unlock transition if real home is not running
This commit is contained in:
TreeHugger Robot
2016-09-04 01:39:30 +00:00
committed by Android (Google) Code Review
6 changed files with 49 additions and 24 deletions

View File

@@ -16,12 +16,8 @@
package com.android.keyguard; package com.android.keyguard;
import android.animation.Animator;
import android.animation.ObjectAnimator;
import android.content.Context; import android.content.Context;
import android.util.AttributeSet; import android.util.AttributeSet;
import android.view.RenderNode;
import android.view.RenderNodeAnimator;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.view.animation.AnimationUtils; import android.view.animation.AnimationUtils;
@@ -144,9 +140,10 @@ public class KeyguardPINView extends KeyguardPinBasedInputView {
setTranslationY(0); setTranslationY(0);
AppearAnimationUtils.startTranslationYAnimation(this, 0 /* delay */, 280 /* duration */, AppearAnimationUtils.startTranslationYAnimation(this, 0 /* delay */, 280 /* duration */,
mDisappearYTranslation, mDisappearAnimationUtils.getInterpolator()); mDisappearYTranslation, mDisappearAnimationUtils.getInterpolator());
DisappearAnimationUtils disappearAnimationUtils = mKeyguardUpdateMonitor.isUserUnlocked() DisappearAnimationUtils disappearAnimationUtils = mKeyguardUpdateMonitor
? mDisappearAnimationUtils .needsSlowUnlockTransition()
: mDisappearAnimationUtilsLocked; ? mDisappearAnimationUtils
: mDisappearAnimationUtilsLocked;
disappearAnimationUtils.startAnimation2d(mViews, disappearAnimationUtils.startAnimation2d(mViews,
new Runnable() { new Runnable() {
@Override @Override

View File

@@ -408,9 +408,9 @@ public class KeyguardPatternView extends LinearLayout implements KeyguardSecurit
@Override @Override
public boolean startDisappearAnimation(final Runnable finishRunnable) { public boolean startDisappearAnimation(final Runnable finishRunnable) {
float durationMultiplier = mKeyguardUpdateMonitor.isUserUnlocked() float durationMultiplier = mKeyguardUpdateMonitor.needsSlowUnlockTransition()
? 1f ? DISAPPEAR_MULTIPLIER_LOCKED
: DISAPPEAR_MULTIPLIER_LOCKED; : 1f;
mLockPatternView.clearPattern(); mLockPatternView.clearPattern();
enableClipping(false); enableClipping(false);
setTranslationY(0); setTranslationY(0);
@@ -419,9 +419,10 @@ public class KeyguardPatternView extends LinearLayout implements KeyguardSecurit
-mDisappearAnimationUtils.getStartTranslation(), -mDisappearAnimationUtils.getStartTranslation(),
mDisappearAnimationUtils.getInterpolator()); mDisappearAnimationUtils.getInterpolator());
DisappearAnimationUtils disappearAnimationUtils = mKeyguardUpdateMonitor.isUserUnlocked() DisappearAnimationUtils disappearAnimationUtils = mKeyguardUpdateMonitor
? mDisappearAnimationUtils .needsSlowUnlockTransition()
: mDisappearAnimationUtilsLocked; ? mDisappearAnimationUtilsLocked
: mDisappearAnimationUtils;
disappearAnimationUtils.startAnimation2d(mLockPatternView.getCellStates(), disappearAnimationUtils.startAnimation2d(mLockPatternView.getCellStates(),
() -> { () -> {
enableClipping(true); enableClipping(true);

View File

@@ -34,9 +34,12 @@ import android.app.PendingIntent;
import android.app.admin.DevicePolicyManager; import android.app.admin.DevicePolicyManager;
import android.app.trust.TrustManager; import android.app.trust.TrustManager;
import android.content.BroadcastReceiver; import android.content.BroadcastReceiver;
import android.content.ComponentName;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.IntentFilter; import android.content.IntentFilter;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.database.ContentObserver; import android.database.ContentObserver;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import android.hardware.fingerprint.FingerprintManager; import android.hardware.fingerprint.FingerprintManager;
@@ -159,6 +162,9 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
private static final int DEFAULT_CHARGING_VOLTAGE_MICRO_VOLT = 5000000; private static final int DEFAULT_CHARGING_VOLTAGE_MICRO_VOLT = 5000000;
private static final ComponentName FALLBACK_HOME_COMPONENT = new ComponentName(
"com.android.settings", "com.android.settings.FallbackHome");
private static KeyguardUpdateMonitor sInstance; private static KeyguardUpdateMonitor sInstance;
private final Context mContext; private final Context mContext;
@@ -177,7 +183,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
private boolean mGoingToSleep; private boolean mGoingToSleep;
private boolean mBouncer; private boolean mBouncer;
private boolean mBootCompleted; private boolean mBootCompleted;
private boolean mUserUnlocked; private boolean mNeedsSlowUnlockTransition;
private boolean mHasLockscreenWallpaper; private boolean mHasLockscreenWallpaper;
// Device provisioning state // Device provisioning state
@@ -572,8 +578,8 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
&& !hasFingerprintUnlockTimedOut(sCurrentUser); && !hasFingerprintUnlockTimedOut(sCurrentUser);
} }
public boolean isUserUnlocked() { public boolean needsSlowUnlockTransition() {
return mUserUnlocked; return mNeedsSlowUnlockTransition;
} }
public StrongAuthTracker getStrongAuthTracker() { public StrongAuthTracker getStrongAuthTracker() {
@@ -1444,7 +1450,18 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
private void handleKeyguardReset() { private void handleKeyguardReset() {
if (DEBUG) Log.d(TAG, "handleKeyguardReset"); if (DEBUG) Log.d(TAG, "handleKeyguardReset");
updateFingerprintListeningState(); updateFingerprintListeningState();
mUserUnlocked = mUserManager.isUserUnlocked(getCurrentUser()); mNeedsSlowUnlockTransition = resolveNeedsSlowUnlockTransition();
}
private boolean resolveNeedsSlowUnlockTransition() {
if (mUserManager.isUserUnlocked(getCurrentUser())) {
return false;
}
Intent homeIntent = new Intent(Intent.ACTION_MAIN)
.addCategory(Intent.CATEGORY_HOME);
ResolveInfo resolveInfo = mContext.getPackageManager().resolveActivity(homeIntent,
0 /* flags */);
return FALLBACK_HOME_COMPONENT.equals(resolveInfo.getComponentInfo().getComponentName());
} }
/** /**

View File

@@ -176,7 +176,7 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener,
mSkipFirstFrame = skipFirstFrame; mSkipFirstFrame = skipFirstFrame;
mOnAnimationFinished = onAnimationFinished; mOnAnimationFinished = onAnimationFinished;
if (mKeyguardUpdateMonitor.isUserUnlocked()) { if (!mKeyguardUpdateMonitor.needsSlowUnlockTransition()) {
scheduleUpdate(); scheduleUpdate();
// No need to wait for the next frame to be drawn for this case - onPreDraw will execute // No need to wait for the next frame to be drawn for this case - onPreDraw will execute
@@ -241,9 +241,9 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener,
} }
private float getScrimInFrontAlpha() { private float getScrimInFrontAlpha() {
return mKeyguardUpdateMonitor.isUserUnlocked() return mKeyguardUpdateMonitor.needsSlowUnlockTransition()
? SCRIM_IN_FRONT_ALPHA ? SCRIM_IN_FRONT_ALPHA_LOCKED
: SCRIM_IN_FRONT_ALPHA_LOCKED; : SCRIM_IN_FRONT_ALPHA;
} }
private void scheduleUpdate() { private void scheduleUpdate() {
if (mUpdatePending) return; if (mUpdatePending) return;
@@ -405,7 +405,7 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener,
} }
private Interpolator getInterpolator() { private Interpolator getInterpolator() {
if (mAnimateKeyguardFadingOut && !mKeyguardUpdateMonitor.isUserUnlocked()) { if (mAnimateKeyguardFadingOut && mKeyguardUpdateMonitor.needsSlowUnlockTransition()) {
return KEYGUARD_FADE_OUT_INTERPOLATOR_LOCKED; return KEYGUARD_FADE_OUT_INTERPOLATOR_LOCKED;
} else if (mAnimateKeyguardFadingOut) { } else if (mAnimateKeyguardFadingOut) {
return KEYGUARD_FADE_OUT_INTERPOLATOR; return KEYGUARD_FADE_OUT_INTERPOLATOR;

View File

@@ -291,7 +291,7 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
public void hide(long startTime, long fadeoutDuration) { public void hide(long startTime, long fadeoutDuration) {
mShowing = false; mShowing = false;
if (!KeyguardUpdateMonitor.getInstance(mContext).isUserUnlocked()) { if (KeyguardUpdateMonitor.getInstance(mContext).needsSlowUnlockTransition()) {
fadeoutDuration = KEYGUARD_DISMISS_DURATION_LOCKED; fadeoutDuration = KEYGUARD_DISMISS_DURATION_LOCKED;
} }
long uptimeMillis = SystemClock.uptimeMillis(); long uptimeMillis = SystemClock.uptimeMillis();

View File

@@ -538,6 +538,9 @@ public class PackageManagerService extends IPackageManager.Stub {
final boolean mIsPreNUpgrade; final boolean mIsPreNUpgrade;
final boolean mIsPreNMR1Upgrade; final boolean mIsPreNMR1Upgrade;
@GuardedBy("mPackages")
private boolean mDexOptDialogShown;
/** The location for ASEC container files on internal storage. */ /** The location for ASEC container files on internal storage. */
final String mAsecInternalPath; final String mAsecInternalPath;
@@ -7150,7 +7153,11 @@ public class PackageManagerService extends IPackageManager.Stub {
} }
} }
if (doTrim) { if (doTrim) {
if (!isFirstBoot()) { final boolean dexOptDialogShown;
synchronized (mPackages) {
dexOptDialogShown = mDexOptDialogShown;
}
if (!isFirstBoot() && dexOptDialogShown) {
try { try {
ActivityManagerNative.getDefault().showBootMessage( ActivityManagerNative.getDefault().showBootMessage(
mContext.getResources().getString( mContext.getResources().getString(
@@ -7244,6 +7251,9 @@ public class PackageManagerService extends IPackageManager.Stub {
numberOfPackagesVisited, numberOfPackagesToDexopt), true); numberOfPackagesVisited, numberOfPackagesToDexopt), true);
} catch (RemoteException e) { } catch (RemoteException e) {
} }
synchronized (mPackages) {
mDexOptDialogShown = true;
}
} }
// If the OTA updates a system app which was previously preopted to a non-preopted state // If the OTA updates a system app which was previously preopted to a non-preopted state