summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFabian Kozynski <kozynski@google.com>2018-10-29 16:27:42 (GMT)
committerLuca Stefani <luca.stefani.ge1@gmail.com>2019-07-27 20:57:26 (GMT)
commitb221a9a139a85c153aaccb10f4a5c4f466130dc9 (patch)
tree9803a44e9bb421656c9aa9e1a709057a30a09c8b
parente114b10cffa7b243896e9a04e168d7eb8daa9fa5 (diff)
downloadframeworks_base-b221a9a139a85c153aaccb10f4a5c4f466130dc9.zip
frameworks_base-b221a9a139a85c153aaccb10f4a5c4f466130dc9.tar.gz
frameworks_base-b221a9a139a85c153aaccb10f4a5c4f466130dc9.tar.bz2
Fixes context for tiles without longClick
QSTile can declare whether it doesn't support (has no effect) long click and then TalkBack will not report it as an available option. Test: manual & atest Change-Id: Iec21181f4308c7c8c4962f191fa0787e053ae944 Merged-In: Iec21181f4308c7c8c4962f191fa0787e053ae944 Fixes: 117921787
-rw-r--r--packages/SystemUI/plugin/src/com/android/systemui/plugins/qs/QSTile.java5
-rw-r--r--packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSTileBaseView.java13
-rw-r--r--packages/SystemUI/src/com/android/systemui/qs/tiles/FlashlightTile.java5
3 files changed, 16 insertions, 7 deletions
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 7d3691a..5224d4a 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
@@ -116,6 +116,7 @@ public interface QSTile {
public boolean isTransient = false;
public String expandedAccessibilityClassName;
public SlashState slash;
+ public boolean handlesLongClick = true;
public boolean copyTo(State other) {
if (other == null) throw new IllegalArgumentException();
@@ -133,7 +134,8 @@ public interface QSTile {
|| !Objects.equals(other.state, state)
|| !Objects.equals(other.isTransient, isTransient)
|| !Objects.equals(other.dualTarget, dualTarget)
- || !Objects.equals(other.slash, slash);
+ || !Objects.equals(other.slash, slash)
+ || !Objects.equals(other.handlesLongClick, handlesLongClick);
other.icon = icon;
other.iconSupplier = iconSupplier;
other.label = label;
@@ -146,6 +148,7 @@ public interface QSTile {
other.dualTarget = dualTarget;
other.isTransient = isTransient;
other.slash = slash != null ? slash.copy() : null;
+ other.handlesLongClick = handlesLongClick;
return changed;
}
diff --git a/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSTileBaseView.java b/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSTileBaseView.java
index 42e5adc..ac111ee 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSTileBaseView.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSTileBaseView.java
@@ -193,6 +193,7 @@ public class QSTileBaseView extends com.android.systemui.plugins.qs.QSTileView {
setClickable(state.state != Tile.STATE_UNAVAILABLE);
mIcon.setIcon(state);
+ setLongClickable(state.handlesLongClick);
setContentDescription(state.contentDescription);
mAccessibilityClass = state.expandedAccessibilityClassName;
@@ -276,10 +277,14 @@ public class QSTileBaseView extends com.android.systemui.plugins.qs.QSTileView {
info.setText(label);
info.setChecked(b);
info.setCheckable(true);
- info.addAction(
- new AccessibilityNodeInfo.AccessibilityAction(
- AccessibilityNodeInfo.AccessibilityAction.ACTION_LONG_CLICK.getId(),
- getResources().getString(R.string.accessibility_long_click_tile)));
+ if (isLongClickable()) {
+ info.addAction(
+ new AccessibilityNodeInfo.AccessibilityAction(
+ AccessibilityNodeInfo.AccessibilityAction
+ .ACTION_LONG_CLICK.getId(),
+ getResources().getString(
+ R.string.accessibility_long_click_tile)));
+ }
}
}
}
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 f2ead1c..d7ac253 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/tiles/FlashlightTile.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/FlashlightTile.java
@@ -18,7 +18,6 @@ package com.android.systemui.qs.tiles;
import android.app.ActivityManager;
import android.content.Intent;
-import android.graphics.drawable.Drawable;
import android.provider.MediaStore;
import android.service.quicksettings.Tile;
import android.widget.Switch;
@@ -50,7 +49,9 @@ public class FlashlightTile extends QSTileImpl<BooleanState> implements
@Override
public BooleanState newTileState() {
- return new BooleanState();
+ BooleanState state = new BooleanState();
+ state.handlesLongClick = false;
+ return state;
}
@Override