Merge "Deprecate unused methods in QSTileImpl"
This commit is contained in:
committed by
Android (Google) Code Review
commit
ffe4331a9b
@@ -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()
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -242,15 +242,6 @@ public class BluetoothTile extends QSTileImpl<BooleanState> {
|
||||
return MetricsEvent.QS_BLUETOOTH;
|
||||
}
|
||||
|
||||
@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();
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -137,15 +137,6 @@ public class DataSaverTile extends QSTileImpl<BooleanState> implements
|
||||
return MetricsEvent.QS_DATA_SAVER;
|
||||
}
|
||||
|
||||
@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);
|
||||
|
||||
@@ -306,15 +306,6 @@ public class DndTile extends QSTileImpl<BooleanState> {
|
||||
return MetricsEvent.QS_DND;
|
||||
}
|
||||
|
||||
@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);
|
||||
|
||||
@@ -152,15 +152,6 @@ public class FlashlightTile extends QSTileImpl<BooleanState> implements
|
||||
return MetricsEvent.QS_FLASHLIGHT;
|
||||
}
|
||||
|
||||
@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);
|
||||
|
||||
@@ -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).
|
||||
*/
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -253,20 +253,6 @@ public class WifiTile extends QSTileImpl<SignalState> {
|
||||
return MetricsEvent.QS_WIFI;
|
||||
}
|
||||
|
||||
@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);
|
||||
|
||||
Reference in New Issue
Block a user