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

Commit 06f26dde authored by kaiyiz's avatar kaiyiz Committed by Steve Kondik
Browse files

SystemUI: Add emergency call button in lock screen

Add emergency call button in swipe lock interface.
Update emergency call button after inflating bottom area view
and configuration changes.

CRs-Fixed: 736263

Change-Id: I7d4090da74e164647dd3ab927c40398de0f40a92
parent 4e9db081
Loading
Loading
Loading
Loading
+13 −0
Original line number Original line Diff line number Diff line
@@ -43,6 +43,7 @@ import android.widget.FrameLayout;
import android.widget.TextView;
import android.widget.TextView;


import com.android.internal.widget.LockPatternUtils;
import com.android.internal.widget.LockPatternUtils;
import com.android.keyguard.EmergencyButton;
import com.android.keyguard.KeyguardUpdateMonitor;
import com.android.keyguard.KeyguardUpdateMonitor;
import com.android.keyguard.KeyguardUpdateMonitorCallback;
import com.android.keyguard.KeyguardUpdateMonitorCallback;
import com.android.systemui.R;
import com.android.systemui.R;
@@ -77,6 +78,7 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL
    private KeyguardAffordanceView mPhoneImageView;
    private KeyguardAffordanceView mPhoneImageView;
    private KeyguardAffordanceView mLockIcon;
    private KeyguardAffordanceView mLockIcon;
    private TextView mIndicationText;
    private TextView mIndicationText;
    private EmergencyButton mEmergencyButton;
    private ViewGroup mPreviewContainer;
    private ViewGroup mPreviewContainer;


    private View mPhonePreview;
    private View mPhonePreview;
@@ -156,12 +158,14 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL
        mPhoneImageView = (KeyguardAffordanceView) findViewById(R.id.phone_button);
        mPhoneImageView = (KeyguardAffordanceView) findViewById(R.id.phone_button);
        mLockIcon = (KeyguardAffordanceView) findViewById(R.id.lock_icon);
        mLockIcon = (KeyguardAffordanceView) findViewById(R.id.lock_icon);
        mIndicationText = (TextView) findViewById(R.id.keyguard_indication_text);
        mIndicationText = (TextView) findViewById(R.id.keyguard_indication_text);
        mEmergencyButton = (EmergencyButton) findViewById(R.id.emergency_call_button);
        watchForCameraPolicyChanges();
        watchForCameraPolicyChanges();
        updateCameraVisibility();
        updateCameraVisibility();
        updatePhoneVisibility();
        updatePhoneVisibility();
        mUnlockMethodCache = UnlockMethodCache.getInstance(getContext());
        mUnlockMethodCache = UnlockMethodCache.getInstance(getContext());
        mUnlockMethodCache.addListener(this);
        mUnlockMethodCache.addListener(this);
        updateLockIcon();
        updateLockIcon();
        updateEmergencyButton();
        setClipChildren(false);
        setClipChildren(false);
        setClipToPadding(false);
        setClipToPadding(false);
        mPreviewInflater = new PreviewInflater(mContext, new LockPatternUtils(mContext));
        mPreviewInflater = new PreviewInflater(mContext, new LockPatternUtils(mContext));
@@ -195,6 +199,8 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL
        mIndicationText.setTextSize(TypedValue.COMPLEX_UNIT_PX,
        mIndicationText.setTextSize(TypedValue.COMPLEX_UNIT_PX,
                getResources().getDimensionPixelSize(
                getResources().getDimensionPixelSize(
                        com.android.internal.R.dimen.text_size_small_material));
                        com.android.internal.R.dimen.text_size_small_material));

        updateEmergencyButton();
    }
    }


    public void setActivityStarter(ActivityStarter activityStarter) {
    public void setActivityStarter(ActivityStarter activityStarter) {
@@ -450,6 +456,13 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL
        }
        }
    }
    }


    private void updateEmergencyButton() {
        boolean enabled = getResources().getBoolean(R.bool.config_showEmergencyButton);
        if (mEmergencyButton != null) {
            mLockPatternUtils.updateEmergencyCallButtonState(mEmergencyButton, enabled, false);
        }
    }

    private final BroadcastReceiver mDevicePolicyReceiver = new BroadcastReceiver() {
    private final BroadcastReceiver mDevicePolicyReceiver = new BroadcastReceiver() {
        public void onReceive(Context context, Intent intent) {
        public void onReceive(Context context, Intent intent) {
            post(new Runnable() {
            post(new Runnable() {