diff options
| author | 2022-01-05 20:49:56 +0000 | |
|---|---|---|
| committer | 2022-01-05 20:49:56 +0000 | |
| commit | ffe4331a9b0ab36f29276dc43f3fc6cceed4a01e (patch) | |
| tree | cd35a33ab1b885c083098cdce272e37d548a0139 | |
| parent | fc1416c3966b2ba4de24e82f7e5f91ded1c2f26a (diff) | |
| parent | 7f8742dbf6df130fd8162c44e33a62c03378c0f4 (diff) | |
Merge "Deprecate unused methods in QSTileImpl"
17 files changed, 17 insertions, 167 deletions
diff --git a/packages/SystemUI/docs/qs-tiles.md b/packages/SystemUI/docs/qs-tiles.md index efcb2de0f6c3..4cb765dab741 100644 --- a/packages/SystemUI/docs/qs-tiles.md +++ b/packages/SystemUI/docs/qs-tiles.md @@ -357,10 +357,12 @@ Following are methods that need to be implemented when creating a new SystemUI t Updates the `State` of the Tile based on the state of the device as provided by the respective controller. It will be called every time the Tile becomes visible, is interacted with or `QSTileImpl#refreshState` is called. After this is done, the updated state will be reflected in the UI. * ```java + @Deprecated public int getMetricsCategory() ``` - Identifier for this Tile, as defined in [proto/src/metrics_constants/metrics_constants.proto](/proto/src/metrics_constants/metrics_constants.proto). This is used to log events related to this Tile. + ~~Identifier for this Tile, as defined in [proto/src/metrics_constants/metrics_constants.proto](/proto/src/metrics_constants/metrics_constants.proto). This is used to log events related to this Tile.~~ + This is now deprecated in favor of `UiEvent` that use the tile spec. * ```java public boolean isAvailable() diff --git a/packages/SystemUI/plugin/src/com/android/systemui/plugins/qs/QSTile.java b/packages/SystemUI/plugin/src/com/android/systemui/plugins/qs/QSTile.java index 77018d736163..ffac26b2e272 100644 --- a/packages/SystemUI/plugin/src/com/android/systemui/plugins/qs/QSTile.java +++ b/packages/SystemUI/plugin/src/com/android/systemui/plugins/qs/QSTile.java @@ -40,7 +40,7 @@ import java.util.function.Supplier; @DependsOn(target = Icon.class) @DependsOn(target = State.class) public interface QSTile { - int VERSION = 1; + int VERSION = 2; DetailAdapter getDetailAdapter(); String getTileSpec(); @@ -79,6 +79,12 @@ public interface QSTile { void longClick(@Nullable View view); void userSwitch(int currentUser); + + /** + * @deprecated not needed as {@link com.android.internal.logging.UiEvent} will use + * {@link #getMetricsSpec} + */ + @Deprecated int getMetricsCategory(); void setListening(Object client, boolean listening); @@ -117,7 +123,6 @@ public interface QSTile { void onShowDetail(boolean show); void onToggleStateChanged(boolean state); void onScanStateChanged(boolean state); - void onAnnouncementRequested(CharSequence announcement); } @ProvidesInterface(version = Icon.VERSION) diff --git a/packages/SystemUI/res/values/strings.xml b/packages/SystemUI/res/values/strings.xml index 84820443da4b..95d140f18400 100644 --- a/packages/SystemUI/res/values/strings.xml +++ b/packages/SystemUI/res/values/strings.xml @@ -425,60 +425,24 @@ <!-- Content description for the close button in the zen mode panel introduction message. [CHAR LIMIT=NONE] --> <string name="accessibility_desc_close">Close</string> - <!-- Announcement made when the wifi is turned off (not shown on the screen). [CHAR LIMIT=NONE] --> - <string name="accessibility_quick_settings_wifi_changed_off">Wifi turned off.</string> - <!-- Announcement made when the wifi is turned on (not shown on the screen). [CHAR LIMIT=NONE] --> - <string name="accessibility_quick_settings_wifi_changed_on">Wifi turned on.</string> - <!-- Announcement made when the airplane mode changes to off (not shown on the screen). [CHAR LIMIT=NONE] --> - <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 none (not shown on the screen). [CHAR LIMIT=NONE] --> <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">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> - <!-- 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] --> - <string name="accessibility_quick_settings_dnd_changed_on">Do Not Disturb turned on.</string> <!-- Content description of the bluetooth tile in quick settings (not shown on the screen). [CHAR LIMIT=NONE] --> <string name="accessibility_quick_settings_bluetooth">Bluetooth.</string> <!-- Content description of the bluetooth tile in quick settings when on (not shown on the screen). [CHAR LIMIT=NONE] --> <string name="accessibility_quick_settings_bluetooth_on">Bluetooth on.</string> - <!-- Announcement made when the bluetooth is turned off (not shown on the screen). [CHAR LIMIT=NONE] --> - <string name="accessibility_quick_settings_bluetooth_changed_off">Bluetooth turned off.</string> - <!-- Announcement made when the bluetooth is turned on (not shown on the screen). [CHAR LIMIT=NONE] --> - <string name="accessibility_quick_settings_bluetooth_changed_on">Bluetooth turned on.</string> - <!-- Announcement made when the location tile changes to off (not shown on the screen). [CHAR LIMIT=NONE] --> - <string name="accessibility_quick_settings_location_changed_off">Location reporting turned off.</string> - <!-- Announcement made when the location tile changes to on (not shown on the screen). [CHAR LIMIT=NONE] --> - <string name="accessibility_quick_settings_location_changed_on">Location reporting turned on.</string> <!-- Content description of the alarm tile in quick settings (not shown on the screen). [CHAR LIMIT=NONE] --> <string name="accessibility_quick_settings_alarm">Alarm set for <xliff:g id="time" example="Wed 3:30 PM">%s</xliff:g>.</string> <!-- Content description of zen mode time condition plus button (not shown on the screen). [CHAR LIMIT=NONE] --> <string name="accessibility_quick_settings_more_time">More time.</string> <!-- Content description of zen mode time condition minus button (not shown on the screen). [CHAR LIMIT=NONE] --> <string name="accessibility_quick_settings_less_time">Less time.</string> - <!-- Announcement made when the flashlight state changes to off (not shown on the screen). [CHAR LIMIT=NONE] --> - <string name="accessibility_quick_settings_flashlight_changed_off">Flashlight turned off.</string> - <!-- Announcement made when the flashlight state changes to on (not shown on the screen). [CHAR LIMIT=NONE] --> - <string name="accessibility_quick_settings_flashlight_changed_on">Flashlight turned on.</string> - <!-- Announcement made when the hotspot state changes to off (not shown on the screen). [CHAR LIMIT=NONE] --> - <string name="accessibility_quick_settings_hotspot_changed_off">Mobile hotspot turned off.</string> - <!-- Announcement made when the hotspot state changes to on (not shown on the screen). [CHAR LIMIT=NONE] --> - <string name="accessibility_quick_settings_hotspot_changed_on">Mobile hotspot turned on.</string> <!-- Announcement made when the screen stopped casting (not shown on the screen). [CHAR LIMIT=NONE] --> <string name="accessibility_casting_turned_off">Screen casting stopped.</string> - <!-- Announcement made when the work mode changes to off (not shown on the screen). Paused is used as a verb. [CHAR LIMIT=NONE] --> - <!-- Announcement made when the work mode changes to on (not shown on the screen). [CHAR LIMIT=NONE] --> - <!-- Announcement made when the Data Saver changes to off (not shown on the screen). [CHAR LIMIT=NONE] --> - <string name="accessibility_quick_settings_data_saver_changed_off">Data Saver turned off.</string> - <!-- Announcement made when the Data Saver changes to on (not shown on the screen). [CHAR LIMIT=NONE] --> - <string name="accessibility_quick_settings_data_saver_changed_on">Data Saver turned on.</string> - <!-- Announcement made when the Sensor Privacy changes to off (not shown on the screen). [CHAR LIMIT=NONE] --> - <!-- Announcement made when the Sensor Privacy changes to on (not shown on the screen). [CHAR LIMIT=NONE] --> <!-- Content description of the display brightness slider (not shown on the screen). [CHAR LIMIT=NONE] --> <string name="accessibility_brightness">Display brightness</string> diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java b/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java index 6ab1c1358bf1..38061a85cc5a 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java +++ b/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java @@ -576,14 +576,6 @@ public class QSPanel extends LinearLayout implements Tunable { fireScanStateChanged(tileRecord.scanState); } } - - @Override - public void onAnnouncementRequested(CharSequence announcement) { - if (announcement != null) { - mHandler.obtainMessage(H.ANNOUNCE_FOR_ACCESSIBILITY, announcement) - .sendToTarget(); - } - } }; tileRecord.tile.addCallback(callback); diff --git a/packages/SystemUI/src/com/android/systemui/qs/customize/TileQueryHelper.java b/packages/SystemUI/src/com/android/systemui/qs/customize/TileQueryHelper.java index d4350f16873b..eae256532c54 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/customize/TileQueryHelper.java +++ b/packages/SystemUI/src/com/android/systemui/qs/customize/TileQueryHelper.java @@ -212,9 +212,6 @@ public class TileQueryHelper { @Override public void onScanStateChanged(boolean state) {} - - @Override - public void onAnnouncementRequested(CharSequence announcement) {} } private void addPackageTiles(final QSTileHost host) { diff --git a/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSTileImpl.java b/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSTileImpl.java index 70e3a2b2bf26..b5f07d175274 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSTileImpl.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSTileImpl.java @@ -156,8 +156,14 @@ public abstract class QSTileImpl<TState extends State> implements QSTile, Lifecy * * Categories are defined in {@link com.android.internal.logging.nano.MetricsProto.MetricsEvent} * by editing frameworks/base/proto/src/metrics_constants.proto. + * + * @deprecated Not needed as this logging is deprecated. Logging tiles is done using + * {@link QSTile#getMetricsSpec} */ - abstract public int getMetricsCategory(); + @Deprecated + public int getMetricsCategory() { + return 0; + } /** * Performs initialization of the tile @@ -445,27 +451,11 @@ public abstract class QSTileImpl<TState extends State> implements QSTile, Lifecy } private void handleStateChanged() { - boolean delayAnnouncement = shouldAnnouncementBeDelayed(); if (mCallbacks.size() != 0) { for (int i = 0; i < mCallbacks.size(); i++) { mCallbacks.get(i).onStateChanged(mState); } - if (mAnnounceNextStateChange && !delayAnnouncement) { - String announcement = composeChangeAnnouncement(); - if (announcement != null) { - mCallbacks.get(0).onAnnouncementRequested(announcement); - } - } } - mAnnounceNextStateChange = mAnnounceNextStateChange && delayAnnouncement; - } - - protected boolean shouldAnnouncementBeDelayed() { - return false; - } - - protected String composeChangeAnnouncement() { - return null; } private void handleShowDetail(boolean show) { diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/AirplaneModeTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/AirplaneModeTile.java index 5650a17e703a..ccec80db3ea5 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tiles/AirplaneModeTile.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/AirplaneModeTile.java @@ -144,15 +144,6 @@ public class AirplaneModeTile extends QSTileImpl<BooleanState> { return MetricsEvent.QS_AIRPLANEMODE; } - @Override - protected String composeChangeAnnouncement() { - if (mState.value) { - return mContext.getString(R.string.accessibility_quick_settings_airplane_changed_on); - } else { - return mContext.getString(R.string.accessibility_quick_settings_airplane_changed_off); - } - } - public void handleSetListening(boolean listening) { super.handleSetListening(listening); if (mListening == listening) return; diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/BluetoothTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/BluetoothTile.java index 6fcfc3af9c87..5552105a77c0 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tiles/BluetoothTile.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/BluetoothTile.java @@ -243,15 +243,6 @@ public class BluetoothTile extends QSTileImpl<BooleanState> { } @Override - protected String composeChangeAnnouncement() { - if (mState.value) { - return mContext.getString(R.string.accessibility_quick_settings_bluetooth_changed_on); - } else { - return mContext.getString(R.string.accessibility_quick_settings_bluetooth_changed_off); - } - } - - @Override public boolean isAvailable() { return mController.isBluetoothSupported(); } diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/CastTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/CastTile.java index 6e0ae29630bc..76c84f9b1b9e 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tiles/CastTile.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/CastTile.java @@ -287,15 +287,6 @@ public class CastTile extends QSTileImpl<BooleanState> { return MetricsEvent.QS_CAST; } - @Override - protected String composeChangeAnnouncement() { - if (!mState.value) { - // We only announce when it's turned off to avoid vocal overflow. - return mContext.getString(R.string.accessibility_casting_turned_off); - } - return null; - } - private String getDeviceName(CastDevice device) { return device.name != null ? device.name : mContext.getString(R.string.quick_settings_cast_device_default_name); diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/DataSaverTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/DataSaverTile.java index a2577d6e7f60..1bbe411eee25 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tiles/DataSaverTile.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/DataSaverTile.java @@ -138,15 +138,6 @@ public class DataSaverTile extends QSTileImpl<BooleanState> implements } @Override - protected String composeChangeAnnouncement() { - if (mState.value) { - return mContext.getString(R.string.accessibility_quick_settings_data_saver_changed_on); - } else { - return mContext.getString(R.string.accessibility_quick_settings_data_saver_changed_off); - } - } - - @Override public void onDataSaverChanged(boolean isDataSaving) { refreshState(isDataSaving); } diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/DndTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/DndTile.java index bb274588e1e2..49c548da63f5 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tiles/DndTile.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/DndTile.java @@ -307,15 +307,6 @@ public class DndTile extends QSTileImpl<BooleanState> { } @Override - protected String composeChangeAnnouncement() { - if (mState.value) { - return mContext.getString(R.string.accessibility_quick_settings_dnd_changed_on); - } else { - return mContext.getString(R.string.accessibility_quick_settings_dnd_changed_off); - } - } - - @Override public void handleSetListening(boolean listening) { super.handleSetListening(listening); if (mListening == listening) return; diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/FlashlightTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/FlashlightTile.java index c0065a0ec371..73b0896b06a5 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tiles/FlashlightTile.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/FlashlightTile.java @@ -153,15 +153,6 @@ public class FlashlightTile extends QSTileImpl<BooleanState> implements } @Override - protected String composeChangeAnnouncement() { - if (mState.value) { - return mContext.getString(R.string.accessibility_quick_settings_flashlight_changed_on); - } else { - return mContext.getString(R.string.accessibility_quick_settings_flashlight_changed_off); - } - } - - @Override public void onFlashlightChanged(boolean enabled) { refreshState(enabled); } diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/HotspotTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/HotspotTile.java index 87edc2cf8bac..d7aa8b21a150 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tiles/HotspotTile.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/HotspotTile.java @@ -195,15 +195,6 @@ public class HotspotTile extends QSTileImpl<BooleanState> { return MetricsEvent.QS_HOTSPOT; } - @Override - protected String composeChangeAnnouncement() { - if (mState.value) { - return mContext.getString(R.string.accessibility_quick_settings_hotspot_changed_on); - } else { - return mContext.getString(R.string.accessibility_quick_settings_hotspot_changed_off); - } - } - /** * Listens to changes made to hotspot and data saver states (to toggle tile availability). */ diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/LocationTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/LocationTile.java index 6a018f61a733..fc93f44a44aa 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tiles/LocationTile.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/LocationTile.java @@ -132,15 +132,6 @@ public class LocationTile extends QSTileImpl<BooleanState> { return MetricsEvent.QS_LOCATION; } - @Override - protected String composeChangeAnnouncement() { - if (mState.value) { - return mContext.getString(R.string.accessibility_quick_settings_location_changed_on); - } else { - return mContext.getString(R.string.accessibility_quick_settings_location_changed_off); - } - } - private final class Callback implements LocationChangeCallback, KeyguardStateController.Callback { @Override diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/NfcTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/NfcTile.java index cd2e27a41f1e..0886b46f9d2f 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tiles/NfcTile.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/NfcTile.java @@ -147,15 +147,6 @@ public class NfcTile extends QSTileImpl<BooleanState> { return MetricsEvent.QS_NFC; } - @Override - protected String composeChangeAnnouncement() { - if (mState.value) { - return mContext.getString(R.string.quick_settings_nfc_on); - } else { - return mContext.getString(R.string.quick_settings_nfc_off); - } - } - private NfcAdapter getAdapter() { if (mAdapter == null) { try { diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/RotationLockTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/RotationLockTile.java index 082dc5c4f48f..177c82ed3d78 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tiles/RotationLockTile.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/RotationLockTile.java @@ -203,11 +203,6 @@ public class RotationLockTile extends QSTileImpl<BooleanState> implements return mContext.getString(R.string.accessibility_quick_settings_rotation); } - @Override - protected String composeChangeAnnouncement() { - return getAccessibilityString(mState.value); - } - private final RotationLockControllerCallback mCallback = new RotationLockControllerCallback() { @Override public void onRotationLockStateChanged(boolean rotationLocked, boolean affordanceVisible) { diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/WifiTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/WifiTile.java index da0069f29b1c..1608248f7c54 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tiles/WifiTile.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/WifiTile.java @@ -254,20 +254,6 @@ public class WifiTile extends QSTileImpl<SignalState> { } @Override - protected boolean shouldAnnouncementBeDelayed() { - return mStateBeforeClick.value == mState.value; - } - - @Override - protected String composeChangeAnnouncement() { - if (mState.value) { - return mContext.getString(R.string.accessibility_quick_settings_wifi_changed_on); - } else { - return mContext.getString(R.string.accessibility_quick_settings_wifi_changed_off); - } - } - - @Override public boolean isAvailable() { return mContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_WIFI); } |