Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 646860b2 authored by The Android Open Source Project's avatar The Android Open Source Project
Browse files

Code drop from //branches/cupcake/...@124589

parent e5ed42d1
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -7,6 +7,7 @@ include $(CLEAR_VARS)
LOCAL_SRC_FILES := \
            $(call all-subdir-java-files)

LOCAL_MODULE:= android.policy
LOCAL_MODULE := android.policy_phone
LOCAL_UNINSTALLABLE_MODULE := true

include $(BUILD_JAVA_LIBRARY)
+5 −0
Original line number Diff line number Diff line
@@ -58,4 +58,9 @@ public interface KeyguardScreenCallback extends KeyguardViewCallback {
     */
    void reportFailedPatternAttempt();

    /**
     * Report whether we there's another way to unlock the device.
     * @return true 
     */
    boolean doesFallbackUnlockScreenExist();
}
+7 −7
Original line number Diff line number Diff line
@@ -160,8 +160,8 @@ public class KeyguardUpdateMonitor {
            }
        };

        mDeviceProvisioned = Settings.System.getInt(
                mContext.getContentResolver(), Settings.System.DEVICE_PROVISIONED, 0) != 0;
        mDeviceProvisioned = Settings.Secure.getInt(
                mContext.getContentResolver(), Settings.Secure.DEVICE_PROVISIONED, 0) != 0;
     
        // Since device can't be un-provisioned, we only need to register a content observer
        // to update mDeviceProvisioned when we are...
@@ -170,8 +170,8 @@ public class KeyguardUpdateMonitor {
                @Override
                public void onChange(boolean selfChange) {
                    super.onChange(selfChange);
                    mDeviceProvisioned = Settings.System.getInt(mContext.getContentResolver(), 
                            Settings.System.DEVICE_PROVISIONED, 0) != 0;
                    mDeviceProvisioned = Settings.Secure.getInt(mContext.getContentResolver(), 
                        Settings.Secure.DEVICE_PROVISIONED, 0) != 0;
                    if (mDeviceProvisioned && mContentObserver != null) {
                        // We don't need the observer anymore...
                        mContext.getContentResolver().unregisterContentObserver(mContentObserver);
@@ -182,13 +182,13 @@ public class KeyguardUpdateMonitor {
            };
            
            mContext.getContentResolver().registerContentObserver(
                    Settings.System.getUriFor(Settings.System.DEVICE_PROVISIONED),
                    Settings.Secure.getUriFor(Settings.Secure.DEVICE_PROVISIONED),
                    false, mContentObserver);
            
            // prevent a race condition between where we check the flag and where we register the
            // observer by grabbing the value once again...
            mDeviceProvisioned = Settings.System.getInt(mContext.getContentResolver(), 
                    Settings.System.DEVICE_PROVISIONED, 0) != 0;
            mDeviceProvisioned = Settings.Secure.getInt(mContext.getContentResolver(), 
                Settings.Secure.DEVICE_PROVISIONED, 0) != 0;
        }
        
        mInPortrait = queryInPortrait();
+14 −2
Original line number Diff line number Diff line
@@ -131,7 +131,13 @@ public abstract class KeyguardViewBase extends FrameLayout {
        final int keyCode = event.getKeyCode();
        if (event.getAction() == KeyEvent.ACTION_DOWN) {
            switch (keyCode) {
                case KeyEvent.KEYCODE_HEADSETHOOK: {
                case KeyEvent.KEYCODE_HEADSETHOOK: 
                case KeyEvent.KEYCODE_PLAYPAUSE: 
                case KeyEvent.KEYCODE_STOP: 
                case KeyEvent.KEYCODE_NEXTSONG: 
                case KeyEvent.KEYCODE_PREVIOUSSONG: 
                case KeyEvent.KEYCODE_REWIND: 
                case KeyEvent.KEYCODE_FORWARD: {
                    Intent intent = new Intent(Intent.ACTION_MEDIA_BUTTON, null);
                    intent.putExtra(Intent.EXTRA_KEY_EVENT, event);
                    getContext().sendOrderedBroadcast(intent, null);
@@ -161,7 +167,13 @@ public abstract class KeyguardViewBase extends FrameLayout {
            }
        } else if (event.getAction() == KeyEvent.ACTION_UP) {
            switch (keyCode) {
                case KeyEvent.KEYCODE_HEADSETHOOK: {
                case KeyEvent.KEYCODE_HEADSETHOOK: 
                case KeyEvent.KEYCODE_PLAYPAUSE: 
                case KeyEvent.KEYCODE_STOP: 
                case KeyEvent.KEYCODE_NEXTSONG: 
                case KeyEvent.KEYCODE_PREVIOUSSONG: 
                case KeyEvent.KEYCODE_REWIND: 
                case KeyEvent.KEYCODE_FORWARD: {
                    Intent intent = new Intent(Intent.ACTION_MEDIA_BUTTON, null);
                    intent.putExtra(Intent.EXTRA_KEY_EVENT, event);
                    getContext().sendOrderedBroadcast(intent, null);
+13 −1
Original line number Diff line number Diff line
@@ -131,6 +131,8 @@ public class KeyguardViewMediator implements KeyguardViewCallback,
    private Context mContext;
    private AlarmManager mAlarmManager;

    private boolean mSystemReady;
    
    /** Low level access to the power manager for enableUserActivity.  Having this
     * requires that we run in the system process.  */
    LocalPowerManager mRealPowerManager;
@@ -254,6 +256,7 @@ public class KeyguardViewMediator implements KeyguardViewCallback,
    public void onSystemReady() {
        synchronized (this) {
            if (DEBUG) Log.d(TAG, "onSystemReady");
            mSystemReady = true;
            doKeyguard();
        }
    }
@@ -639,6 +642,12 @@ public class KeyguardViewMediator implements KeyguardViewCallback,
            case KeyEvent.KEYCODE_VOLUME_UP:
            case KeyEvent.KEYCODE_VOLUME_DOWN:
            case KeyEvent.KEYCODE_HEADSETHOOK: 
            case KeyEvent.KEYCODE_PLAYPAUSE: 
            case KeyEvent.KEYCODE_STOP: 
            case KeyEvent.KEYCODE_NEXTSONG: 
            case KeyEvent.KEYCODE_PREVIOUSSONG: 
            case KeyEvent.KEYCODE_REWIND: 
            case KeyEvent.KEYCODE_FORWARD:
            case KeyEvent.KEYCODE_CAMERA:
                return false;
        }
@@ -806,6 +815,8 @@ public class KeyguardViewMediator implements KeyguardViewCallback,
    private void handleShow() {
        synchronized (KeyguardViewMediator.this) {
            if (DEBUG) Log.d(TAG, "handleShow");
            if (!mSystemReady) return;
            
            // while we're showing, we control the wake state, so ask the power
            // manager not to honor request for userActivity.
            mRealPowerManager.enableUserActivity(false);
@@ -875,6 +886,7 @@ public class KeyguardViewMediator implements KeyguardViewCallback,
        synchronized (KeyguardViewMediator.this) {
            if (DEBUG) Log.d(TAG, "handleVerifyUnlock");
            mKeyguardViewManager.verifyUnlock();
            mShowing = true;
        }
    }

Loading