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

Commit e5fbe9b9 authored by Daniel Sandler's avatar Daniel Sandler
Browse files

New "device is locked" status bar icon, part 2.

Shown whenever the secure lockscreen is (a) visible, or (b)
active but hidden due to a FLAG_SHOW_WHEN_LOCKED Activity.

Change-Id: I0e08a952904cc4728621953a42806edf26eb8e46
parent 192feae7
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -28,6 +28,7 @@ import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Handler;
import android.os.IBinder;
import android.os.LocalPowerManager;
import android.os.Message;
import android.os.PowerManager;
@@ -138,6 +139,7 @@ public class KeyguardViewMediator implements KeyguardViewCallback,
    private Context mContext;
    private AlarmManager mAlarmManager;
    private StatusBarManager mStatusBarManager;
    private IBinder mSecureLockIcon = null;

    private boolean mSystemReady;

@@ -965,6 +967,19 @@ public class KeyguardViewMediator implements KeyguardViewCallback,
        if (mStatusBarManager == null) {
            Log.w(TAG, "Could not get status bar manager");
        } else {
            // Give feedback to user when secure keyguard is active and engaged
            if (mShowing && isSecure()) {
                if (mSecureLockIcon == null) {
                    mSecureLockIcon = mStatusBarManager.addIcon("secure",
                        com.android.internal.R.drawable.stat_sys_secure, 0);
                }
            } else {
                if (mSecureLockIcon != null) {
                    mStatusBarManager.removeIcon(mSecureLockIcon);
                    mSecureLockIcon = null;
                }
            }

            // if the keyguard is shown, allow the status bar to open
            // only if the keyguard is insecure and is covered by another window
            boolean enable = !mShowing || (mHidden && !isSecure());