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

Commit 8da9374a authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "A new ui flow for screen pinning feature" into rvc-dev

parents c4310e59 ae661a07
Loading
Loading
Loading
Loading
+28 −3
Original line number Diff line number Diff line
@@ -9224,9 +9224,34 @@
    <string name="switch_off_text">Off</string>
    <!-- [CHAR LIMIT=28] Screen pinning title -->
    <string name="screen_pinning_title">Screen pinning</string>
    <!-- [CHAR LIMIT=300] Screen pinning description -->
    <string name="screen_pinning_description">When this setting is turned on, you can use screen pinning to keep the current screen in view until you unpin.\n\nTo use screen pinning:\n\n1. Make sure screen pinning is turned on\n\n2. Open Overview\n\n3. Tap the app icon at the top of the screen, then tap Pin</string>
    <string name="screen_pinning_title">App pinning</string>
    <!-- [CHAR LIMIT=none] Screen pinning description -->
    <string name="screen_pinning_description">
        App pinning allows you to keep the current app in view until you unpin it. This feature can be used, for example, to let a trusted friend play a specific game.
        \n\nWhen an app is pinned, the pinned app may open other apps and personal data may be accessible.
        \n\nTo use app pinning:
        \t\n1.\tTurn on app pinning
        \t\n2.\tOpen Overview
        \t\n3.\tTap the app icon at the top of the screen, then tap Pin
    </string>
    <!-- [CHAR LIMIT=none] Screen pinning description -->
    <string name="screen_pinning_guest_mode_description">
        App pinning allows you to keep the current app in view until you unpin it. This feature can be used, for example, to let a trusted friend play a specific game.
        \n\nWhen an app is pinned, the pinned app may open other apps and personal data may be accessible.
        \n\nIf you want to securely share your device with someone, try using a guest profile instead.
        \n\nTo use app pinning:
        \t\n1.\tTurn on app pinning
        \t\n2.\tOpen Overview
        \t\n3.\tTap the app icon at the top of the screen, then tap Pin
    </string>
    <!-- [CHAR LIMIT=300] Screen pinning title -->
    <string name="screen_pinning_dialog_message">
        When app is pinned:
        \n\n\u2022\t\tPersonal data may be accessible
        \n\t\t(such as contacts and email content)
        \n\u2022\t\tPinned app may open other apps
        \n\nOnly use app pinning with people you trust.
    </string>
    <!-- [CHAR LIMIT=60] Unlock setting for screen pinning -->
    <string name="screen_pinning_unlock_pattern">Ask for unlock pattern before unpinning</string>
    <!-- [CHAR LIMIT=60] Unlock setting for screen pinning -->
+35 −13
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ package com.android.settings.security;
import android.app.admin.DevicePolicyManager;
import android.app.settings.SettingsEnums;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.os.UserHandle;
@@ -25,6 +26,7 @@ import android.provider.SearchIndexableResource;
import android.provider.Settings;
import android.widget.Switch;

import androidx.appcompat.app.AlertDialog;
import androidx.preference.Preference;
import androidx.preference.Preference.OnPreferenceChangeListener;
import androidx.preference.PreferenceScreen;
@@ -43,12 +45,13 @@ import com.android.settingslib.widget.FooterPreference;
import java.util.Arrays;
import java.util.List;


/**
 * Screen pinning settings.
 */
@SearchIndexable
public class ScreenPinningSettings extends SettingsPreferenceFragment
        implements SwitchBar.OnSwitchChangeListener {
        implements SwitchBar.OnSwitchChangeListener, DialogInterface.OnClickListener {

    private static final String KEY_USE_SCREEN_LOCK = "use_screen_lock";
    private static final String KEY_FOOTER = "screen_pinning_settings_screen_footer";
@@ -78,9 +81,9 @@ public class ScreenPinningSettings extends SettingsPreferenceFragment
        mFooterPreference = root.findPreference(KEY_FOOTER);

        mSwitchBar = activity.getSwitchBar();
        mSwitchBar.addOnSwitchChangeListener(this);
        mSwitchBar.show();
        mSwitchBar.setChecked(isLockToAppEnabled(getActivity()));
        mSwitchBar.addOnSwitchChangeListener(this);

        updateDisplay();
    }
@@ -184,7 +187,26 @@ public class ScreenPinningSettings extends SettingsPreferenceFragment
     */
    @Override
    public void onSwitchChanged(Switch switchView, boolean isChecked) {
        setLockToAppEnabled(isChecked);
        if (isChecked) {
            new AlertDialog.Builder(getContext())
                    .setMessage(R.string.screen_pinning_dialog_message)
                    .setPositiveButton(R.string.dlg_ok, this)
                    .setNegativeButton(R.string.dlg_cancel, this)
                    .setCancelable(false)
                    .show();
        } else {
            setLockToAppEnabled(false);
            updateDisplay();
        }
    }

    @Override
    public void onClick(DialogInterface dialogInterface, int which) {
        if (which == DialogInterface.BUTTON_POSITIVE) {
            setLockToAppEnabled(true);
        } else {
            mSwitchBar.setChecked(false);
        }
        updateDisplay();
    }