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

Commit ea25ea7e authored by Svetoslav Ganov's avatar Svetoslav Ganov Committed by Android (Google) Code Review
Browse files

Merge "Adding a system preference whether to speak passwords in accessibility mode." into ics-mr1

parents 4079702a 55f937ab
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -17433,6 +17433,7 @@ package android.provider {
    method public static boolean putString(android.content.ContentResolver, java.lang.String, java.lang.String);
    method public static final void setLocationProviderEnabled(android.content.ContentResolver, java.lang.String, boolean);
    field public static final java.lang.String ACCESSIBILITY_ENABLED = "accessibility_enabled";
    field public static final java.lang.String ACCESSIBILITY_SPEAK_PASSWORD = "speak_password";
    field public static final java.lang.String ADB_ENABLED = "adb_enabled";
    field public static final java.lang.String ALLOWED_GEOLOCATION_ORIGINS = "allowed_geolocation_origins";
    field public static final java.lang.String ALLOW_MOCK_LOCATION = "mock_location";
+8 −2
Original line number Diff line number Diff line
@@ -31,6 +31,7 @@ import android.inputmethodservice.Keyboard.Key;
import android.media.AudioManager;
import android.os.Handler;
import android.os.Message;
import android.provider.Settings;
import android.util.AttributeSet;
import android.util.TypedValue;
import android.view.GestureDetector;
@@ -967,8 +968,13 @@ public class KeyboardView extends View implements View.OnClickListener {
            AccessibilityEvent event = AccessibilityEvent.obtain(eventType);
            onInitializeAccessibilityEvent(event);
            String text = null;
            // Add text only if headset is used to avoid leaking passwords.
            if (mAudioManager.isBluetoothA2dpOn() || mAudioManager.isWiredHeadsetOn()) {
            // This is very efficient since the properties are cached.
            final boolean speakPassword = Settings.Secure.getInt(mContext.getContentResolver(),
                    Settings.Secure.ACCESSIBILITY_SPEAK_PASSWORD, 0) != 0;
            // Add text only if password announcement is enabled or if headset is
            // used to avoid leaking passwords.
            if (speakPassword || mAudioManager.isBluetoothA2dpOn()
                    || mAudioManager.isWiredHeadsetOn()) {
                switch (code) {
                    case Keyboard.KEYCODE_ALT:
                        text = mContext.getString(R.string.keyboardview_keycode_alt);
+6 −0
Original line number Diff line number Diff line
@@ -2753,6 +2753,11 @@ public final class Settings {
        public static final String ENABLED_ACCESSIBILITY_SERVICES =
            "enabled_accessibility_services";

        /**
         * Whether to speak passwords while in accessibility mode.
         */
        public static final String ACCESSIBILITY_SPEAK_PASSWORD = "speak_password";

        /**
         * If injection of accessibility enhancing JavaScript scripts
         * is enabled.
@@ -4079,6 +4084,7 @@ public final class Settings {
            ENABLED_ACCESSIBILITY_SERVICES,
            TOUCH_EXPLORATION_ENABLED,
            ACCESSIBILITY_ENABLED,
            ACCESSIBILITY_SPEAK_PASSWORD,
            TTS_USE_DEFAULTS,
            TTS_DEFAULT_RATE,
            TTS_DEFAULT_PITCH,
+3 −0
Original line number Diff line number Diff line
@@ -80,6 +80,9 @@
    <!-- Default for Settings.Secure.ACCESSIBILITY_SCRIPT_INJECTION -->
    <bool name="def_accessibility_script_injection">false</bool>

    <!-- Default for Settings.Secure.ACCESSIBILITY_SPEAK_PASSWORD -->
    <bool name="def_accessibility_speak_password">false</bool>

    <!-- Default for Settings.Secure.ACCESSIBILITY_WEB_CONTENT_KEY_BINDINGS -->
    <string name="def_accessibility_web_content_key_bindings" translatable="false">
            <!-- DPAD/Trackball UP - traverse previous on current axis and send an event. -->
+20 −1
Original line number Diff line number Diff line
@@ -63,7 +63,7 @@ public class DatabaseHelper extends SQLiteOpenHelper {
    // database gets upgraded properly. At a minimum, please confirm that 'upgradeVersion'
    // is properly propagated through your change.  Not doing so will result in a loss of user
    // settings.
    private static final int DATABASE_VERSION = 71;
    private static final int DATABASE_VERSION = 72;

    private Context mContext;

@@ -952,6 +952,22 @@ public class DatabaseHelper extends SQLiteOpenHelper {
            upgradeVersion = 71;
        }

        if (upgradeVersion == 71) {
             // New setting to specify whether to speak passwords in accessibility mode.
            db.beginTransaction();
            SQLiteStatement stmt = null;
            try {
                stmt = db.compileStatement("INSERT INTO secure(name,value)"
                        + " VALUES(?,?);");
                loadBooleanSetting(stmt, Settings.Secure.ACCESSIBILITY_SPEAK_PASSWORD,
                        R.bool.def_accessibility_speak_password);
            } finally {
                db.endTransaction();
                if (stmt != null) stmt.close();
            }
            upgradeVersion = 72;
        }

        // *** Remember to update DATABASE_VERSION above!

        if (upgradeVersion != currentVersion) {
@@ -1489,6 +1505,9 @@ public class DatabaseHelper extends SQLiteOpenHelper {

            loadBooleanSetting(stmt, Settings.Secure.TOUCH_EXPLORATION_ENABLED,
                    R.bool.def_touch_exploration_enabled);

            loadBooleanSetting(stmt, Settings.Secure.ACCESSIBILITY_SPEAK_PASSWORD,
                    R.bool.def_accessibility_speak_password);
        } finally {
            if (stmt != null) stmt.close();
        }