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

Commit 2f61217f authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "Emergency call button on Swipe lock Screen."

parents 0d2ba464 f17cb289
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ import android.content.Intent;
import android.content.res.Configuration;
import android.os.PowerManager;
import android.os.SystemClock;
import android.os.SystemProperties;
import android.os.UserHandle;
import android.telecom.TelecomManager;
import android.util.AttributeSet;
@@ -135,7 +136,7 @@ public class EmergencyButton extends Button {
        }
    }

    private void updateEmergencyCallButton() {
    public void updateEmergencyCallButton() {
        boolean visible = false;
        if (mIsVoiceCapable) {
            // Emergency calling requires voice capability.
@@ -149,7 +150,8 @@ public class EmergencyButton extends Button {
                    visible = mEnableEmergencyCallWhileSimLocked;
                } else {
                    // Only show if there is a secure screen (pin/pattern/SIM pin/SIM puk);
                    visible = mLockPatternUtils.isSecure(KeyguardUpdateMonitor.getCurrentUser());
                    visible = mLockPatternUtils.isSecure(KeyguardUpdateMonitor.getCurrentUser()) ||
                            SystemProperties.getBoolean("persist.radio.emgcy_btn_onswipe", false);
                }
            }
        }
+14 −0
Original line number Diff line number Diff line
@@ -36,6 +36,7 @@ import android.os.IBinder;
import android.os.Message;
import android.os.Messenger;
import android.os.RemoteException;
import android.os.SystemProperties;
import android.os.UserHandle;
import android.provider.MediaStore;
import android.service.media.CameraPrewarmService;
@@ -52,6 +53,7 @@ import android.widget.FrameLayout;
import android.widget.TextView;

import com.android.internal.widget.LockPatternUtils;
import com.android.keyguard.EmergencyButton;
import com.android.keyguard.KeyguardUpdateMonitor;
import com.android.keyguard.KeyguardUpdateMonitorCallback;
import com.android.systemui.EventLogConstants;
@@ -88,6 +90,7 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL
    private static final int DOZE_ANIMATION_ELEMENT_DURATION = 250;
    private static final long TRANSIENT_FP_ERROR_TIMEOUT = 1300;

    private EmergencyButton mEmergencyButton;
    private KeyguardAffordanceView mCameraImageView;
    private KeyguardAffordanceView mLeftAffordanceView;
    private LockIcon mLockIcon;
@@ -188,6 +191,7 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL
        super.onFinishInflate();
        mLockPatternUtils = new LockPatternUtils(mContext);
        mPreviewContainer = (ViewGroup) findViewById(R.id.preview_container);
        mEmergencyButton = (EmergencyButton) findViewById(R.id.emergency_call_button);
        mCameraImageView = (KeyguardAffordanceView) findViewById(R.id.camera_button);
        mLeftAffordanceView = (KeyguardAffordanceView) findViewById(R.id.left_button);
        mLockIcon = (LockIcon) findViewById(R.id.lock_icon);
@@ -197,6 +201,7 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL
        mUnlockMethodCache = UnlockMethodCache.getInstance(getContext());
        mUnlockMethodCache.addListener(this);
        mLockIcon.update();
        updateEmergencyButton();
        setClipChildren(false);
        setClipToPadding(false);
        mPreviewInflater = new PreviewInflater(mContext, new LockPatternUtils(mContext));
@@ -229,6 +234,7 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL
        mIndicationText.setTextSize(TypedValue.COMPLEX_UNIT_PX,
                getResources().getDimensionPixelSize(
                        com.android.internal.R.dimen.text_size_small_material));
        updateEmergencyButton();
    }

    public void setActivityStarter(ActivityStarter activityStarter) {
@@ -699,4 +705,12 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL
        updateLeftAffordanceIcon();
        updateLeftPreview();
    }

    private void updateEmergencyButton() {
        if (SystemProperties.getBoolean("persist.radio.emgcy_btn_onswipe",false)) {
            if (mEmergencyButton != null) {
                mEmergencyButton.updateEmergencyCallButton();
            }
        }
    }
}