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

Commit 418bf622 authored by Amin Shaikh's avatar Amin Shaikh Committed by android-build-merger
Browse files

Merge "Rely on tile state for on/off a11y announcement." into pi-dev

am: df173b59

Change-Id: Ib2e3e17063627b82dc2539e2e9ecb74c3963a16f
parents c925945f df173b59
Loading
Loading
Loading
Loading
+2 −6
Original line number Diff line number Diff line
@@ -515,16 +515,12 @@
    <string name="accessibility_quick_settings_airplane_changed_off">Airplane mode turned off.</string>
    <!-- Announcement made when the airplane mode changes to on (not shown on the screen). [CHAR LIMIT=NONE] -->
    <string name="accessibility_quick_settings_airplane_changed_on">Airplane mode turned on.</string>
    <!-- Content description of the do not disturb tile in quick settings when on in the default priority mode (not shown on the screen). [CHAR LIMIT=NONE] -->
    <string name="accessibility_quick_settings_dnd_priority_on">Do not disturb on.</string>
    <!-- Content description of the do not disturb tile in quick settings when on in none (not shown on the screen). [CHAR LIMIT=NONE] -->
    <string name="accessibility_quick_settings_dnd_none_on">Do not disturb on, total silence.</string>
    <string name="accessibility_quick_settings_dnd_none_on">total silence</string>
    <!-- Content description of the do not disturb tile in quick settings when on in alarms only (not shown on the screen). [CHAR LIMIT=NONE] -->
    <string name="accessibility_quick_settings_dnd_alarms_on">Do not disturb on, alarms only.</string>
    <string name="accessibility_quick_settings_dnd_alarms_on">alarms only</string>
     <!-- Content description of the do not disturb tile in quick settings (not shown on the screen). [CHAR LIMIT=NONE] -->
    <string name="accessibility_quick_settings_dnd">Do not disturb.</string>
     <!-- Content description of the do not disturb tile in quick settings when off (not shown on the screen). [CHAR LIMIT=NONE] -->
    <string name="accessibility_quick_settings_dnd_off">Do not disturb off.</string>
    <!-- Announcement made when do not disturb changes to off (not shown on the screen). [CHAR LIMIT=NONE] -->
    <string name="accessibility_quick_settings_dnd_changed_off">Do not disturb turned off.</string>
    <!-- Announcement made when do not disturb changes to on (not shown on the screen). [CHAR LIMIT=NONE] -->
+9 −8
Original line number Diff line number Diff line
@@ -28,6 +28,7 @@ import android.content.Intent;
import android.graphics.drawable.Drawable;
import android.provider.Settings;
import android.service.quicksettings.Tile;
import android.text.TextUtils;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Switch;
@@ -131,32 +132,32 @@ public class BluetoothTile extends QSTileImpl<BooleanState> {
        }
        state.slash.isSlashed = !enabled;
        state.label = mContext.getString(R.string.quick_settings_bluetooth_label);
        state.secondaryLabel = TextUtils.emptyIfNull(
                getSecondaryLabel(enabled, connected, state.isTransient));
        if (enabled) {
            if (connected) {
                state.icon = new BluetoothConnectedTileIcon();
                state.contentDescription = mContext.getString(
                        R.string.accessibility_bluetooth_name, state.label);

                state.label = mController.getLastDeviceName();
                state.contentDescription =
                        mContext.getString(R.string.accessibility_bluetooth_name, state.label)
                                + ", " + state.secondaryLabel;
            } else if (state.isTransient) {
                state.icon = ResourceIcon.get(R.drawable.ic_bluetooth_transient_animation);
                state.contentDescription = mContext.getString(
                        R.string.accessibility_quick_settings_bluetooth_connecting);
                state.contentDescription = state.secondaryLabel;
            } else {
                state.icon = ResourceIcon.get(R.drawable.ic_qs_bluetooth_on);
                state.contentDescription = mContext.getString(
                        R.string.accessibility_quick_settings_bluetooth_on) + ","
                        R.string.accessibility_quick_settings_bluetooth) + ","
                        + mContext.getString(R.string.accessibility_not_connected);
            }
            state.state = Tile.STATE_ACTIVE;
        } else {
            state.icon = ResourceIcon.get(R.drawable.ic_qs_bluetooth_on);
            state.contentDescription = mContext.getString(
                    R.string.accessibility_quick_settings_bluetooth_off);
                    R.string.accessibility_quick_settings_bluetooth);
            state.state = Tile.STATE_INACTIVE;
        }

        state.secondaryLabel = getSecondaryLabel(enabled, connected, state.isTransient);
        state.dualLabelContentDescription = mContext.getResources().getString(
                R.string.accessibility_quick_settings_open_settings, getTileLabel());
        state.expandedAccessibilityClassName = Switch.class.getName();
+13 −10
Original line number Diff line number Diff line
@@ -36,6 +36,7 @@ import android.provider.Settings.Global;
import android.service.notification.ZenModeConfig;
import android.service.notification.ZenModeConfig.ZenRule;
import android.service.quicksettings.Tile;
import android.text.TextUtils;
import android.util.Slog;
import android.view.LayoutInflater;
import android.view.View;
@@ -224,25 +225,27 @@ public class DndTile extends QSTileImpl<BooleanState> {
        state.state = state.value ? Tile.STATE_ACTIVE : Tile.STATE_INACTIVE;
        state.slash.isSlashed = !state.value;
        state.label = getTileLabel();
        state.secondaryLabel = ZenModeConfig.getDescription(mContext,zen != Global.ZEN_MODE_OFF,
                mController.getConfig(), false);
        state.secondaryLabel = TextUtils.emptyIfNull(ZenModeConfig.getDescription(mContext,
                zen != Global.ZEN_MODE_OFF, mController.getConfig(), false));
        state.icon = ResourceIcon.get(R.drawable.ic_qs_dnd_on);
        checkIfRestrictionEnforcedByAdminOnly(state, UserManager.DISALLOW_ADJUST_VOLUME);
        switch (zen) {
            case Global.ZEN_MODE_IMPORTANT_INTERRUPTIONS:
                state.contentDescription = mContext.getString(
                        R.string.accessibility_quick_settings_dnd_priority_on) + ", "
                state.contentDescription =
                        mContext.getString(R.string.accessibility_quick_settings_dnd) + ", "
                        + state.secondaryLabel;
                break;
            case Global.ZEN_MODE_NO_INTERRUPTIONS:
                state.contentDescription = mContext.getString(
                        R.string.accessibility_quick_settings_dnd_none_on) + ", "
                        + state.secondaryLabel;
                state.contentDescription =
                        mContext.getString(R.string.accessibility_quick_settings_dnd) + ", " +
                        mContext.getString(R.string.accessibility_quick_settings_dnd_none_on)
                                + ", " + state.secondaryLabel;
                break;
            case ZEN_MODE_ALARMS:
                state.contentDescription = mContext.getString(
                        R.string.accessibility_quick_settings_dnd_alarms_on) + ", "
                        + state.secondaryLabel;
                state.contentDescription =
                        mContext.getString(R.string.accessibility_quick_settings_dnd) + ", " +
                        mContext.getString(R.string.accessibility_quick_settings_dnd_alarms_on)
                                + ", " + state.secondaryLabel;
                break;
            default:
                state.contentDescription = mContext.getString(