Merge "Patches for IKeyguardStateCallback" into mnc-dev

This commit is contained in:
Adrian Roos
2015-06-02 21:05:21 +00:00
committed by Android (Google) Code Review

View File

@@ -33,6 +33,7 @@ import android.content.pm.UserInfo;
import android.media.AudioManager; import android.media.AudioManager;
import android.media.SoundPool; import android.media.SoundPool;
import android.os.Bundle; import android.os.Bundle;
import android.os.DeadObjectException;
import android.os.Handler; import android.os.Handler;
import android.os.Looper; import android.os.Looper;
import android.os.Message; import android.os.Message;
@@ -381,14 +382,17 @@ public class KeyguardViewMediator extends SystemUI {
+ ",state=" + simState + ")"); + ",state=" + simState + ")");
} }
try { int size = mKeyguardStateCallbacks.size();
int size = mKeyguardStateCallbacks.size(); boolean simPinSecure = mUpdateMonitor.isSimPinSecure();
boolean simPinSecure = mUpdateMonitor.isSimPinSecure(); for (int i = size - 1; i >= 0; i--) {
for (int i = 0; i < size; i++) { try {
mKeyguardStateCallbacks.get(i).onSimSecureStateChanged(simPinSecure); mKeyguardStateCallbacks.get(i).onSimSecureStateChanged(simPinSecure);
} catch (RemoteException e) {
Slog.w(TAG, "Failed to call onSimSecureStateChanged", e);
if (e instanceof DeadObjectException) {
mKeyguardStateCallbacks.remove(i);
}
} }
} catch (RemoteException e) {
Slog.w(TAG, "Failed to call onSimSecureStateChanged", e);
} }
switch (simState) { switch (simState) {
@@ -551,6 +555,7 @@ public class KeyguardViewMediator extends SystemUI {
// Assume keyguard is showing (unless it's disabled) until we know for sure... // Assume keyguard is showing (unless it's disabled) until we know for sure...
setShowingLocked(!shouldWaitForProvisioning() && !mLockPatternUtils.isLockScreenDisabled( setShowingLocked(!shouldWaitForProvisioning() && !mLockPatternUtils.isLockScreenDisabled(
KeyguardUpdateMonitor.getCurrentUser())); KeyguardUpdateMonitor.getCurrentUser()));
updateInputRestrictedLocked();
mTrustManager.reportKeyguardShowingChanged(); mTrustManager.reportKeyguardShowingChanged();
mStatusBarKeyguardViewManager = new StatusBarKeyguardViewManager(mContext, mStatusBarKeyguardViewManager = new StatusBarKeyguardViewManager(mContext,
@@ -954,13 +959,16 @@ public class KeyguardViewMediator extends SystemUI {
boolean inputRestricted = isInputRestricted(); boolean inputRestricted = isInputRestricted();
if (mInputRestricted != inputRestricted) { if (mInputRestricted != inputRestricted) {
mInputRestricted = inputRestricted; mInputRestricted = inputRestricted;
try { int size = mKeyguardStateCallbacks.size();
int size = mKeyguardStateCallbacks.size(); for (int i = size - 1; i >= 0; i--) {
for (int i = 0; i < size; i++) { try {
mKeyguardStateCallbacks.get(i).onInputRestrictedStateChanged(inputRestricted); mKeyguardStateCallbacks.get(i).onInputRestrictedStateChanged(inputRestricted);
} catch (RemoteException e) {
Slog.w(TAG, "Failed to call onDeviceProvisioned", e);
if (e instanceof DeadObjectException) {
mKeyguardStateCallbacks.remove(i);
}
} }
} catch (RemoteException e) {
Slog.w(TAG, "Failed to call onDeviceProvisioned", e);
} }
} }
} }
@@ -1544,13 +1552,16 @@ public class KeyguardViewMediator extends SystemUI {
private void setShowingLocked(boolean showing) { private void setShowingLocked(boolean showing) {
if (showing != mShowing) { if (showing != mShowing) {
mShowing = showing; mShowing = showing;
try { int size = mKeyguardStateCallbacks.size();
int size = mKeyguardStateCallbacks.size(); for (int i = size - 1; i >= 0; i--) {
for (int i = 0; i < size; i++) { try {
mKeyguardStateCallbacks.get(i).onShowingStateChanged(showing); mKeyguardStateCallbacks.get(i).onShowingStateChanged(showing);
} catch (RemoteException e) {
Slog.w(TAG, "Failed to call onShowingStateChanged", e);
if (e instanceof DeadObjectException) {
mKeyguardStateCallbacks.remove(i);
}
} }
} catch (RemoteException e) {
Slog.w(TAG, "Failed to call onShowingStateChanged", e);
} }
updateInputRestrictedLocked(); updateInputRestrictedLocked();
mTrustManager.reportKeyguardShowingChanged(); mTrustManager.reportKeyguardShowingChanged();
@@ -1565,7 +1576,7 @@ public class KeyguardViewMediator extends SystemUI {
callback.onShowingStateChanged(mShowing); callback.onShowingStateChanged(mShowing);
callback.onInputRestrictedStateChanged(mInputRestricted); callback.onInputRestrictedStateChanged(mInputRestricted);
} catch (RemoteException e) { } catch (RemoteException e) {
Slog.w(TAG, "Failed to call onShowingStateChanged or onSimSecureStateChanged", e); Slog.w(TAG, "Failed to call onShowingStateChanged or onSimSecureStateChanged or onInputRestrictedStateChanged", e);
} }
} }
} }