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

Commit b61449ee authored by d34d's avatar d34d Committed by Gerrit Code Review
Browse files

Screen Pinning: Show correct string for on screen nav

mPolicy.hasNavigationBar() will always return false because
a new PhoneWindowManager was created just for this one method
but the new PhoneWindowManager instance does not load the the
boolean from resources that define whether the device has on
screen navigation bar.  This patch removes the unnecessary instance
of a WindowManager and simply loads in the boolean when constructed.

Change-Id: I09c2ef661bff272cb4f7ca43bac0e45f4b20a4d4
TICKET: CYNGNOS-1111
parent 4829576f
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -24,7 +24,6 @@ import android.os.Message;
import android.os.UserHandle;
import android.provider.Settings;
import android.view.WindowManager;
import android.view.WindowManagerPolicy;
import android.view.accessibility.AccessibilityManager;
import android.widget.Toast;

@@ -40,10 +39,10 @@ public class LockTaskNotify {

    private final Context mContext;
    private final H mHandler;
    private final WindowManagerPolicy mPolicy = PolicyManager.makeNewWindowManager();
    private AccessibilityManager mAccessibilityManager;
    private Toast mLastToast;
    private boolean mDevForceNavbar;
    private boolean mHasNavigationBar;

    public LockTaskNotify(Context context) {
        mContext = context;
@@ -52,6 +51,7 @@ public class LockTaskNotify {
        mHandler = new H();
        SettingsObserver observer = new SettingsObserver(mHandler);
        observer.observe();
        mHasNavigationBar = context.getResources().getBoolean(R.bool.config_showNavigationBar);
    }

    public void showToast(boolean isLocked) {
@@ -65,7 +65,7 @@ public class LockTaskNotify {
        } else if (mAccessibilityManager.isEnabled()) {
            textResId = R.string.lock_to_app_toast_accessible;
        } else {
            textResId = (mPolicy.hasNavigationBar() || mDevForceNavbar)
            textResId = (mHasNavigationBar || mDevForceNavbar)
                    ? R.string.lock_to_app_toast : R.string.lock_to_app_toast_no_navbar;
        }
        if (mLastToast != null) {