summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3/allapps
diff options
context:
space:
mode:
authorarangelov <arangelov@google.com>2018-07-16 17:47:39 +0100
committerarangelov <arangelov@google.com>2018-08-15 16:46:13 +0100
commit1502c673d022ced571382e23302eb4a0aba72f9c (patch)
tree6b7cd6a5defd4656b75524a90bfc6d0b5e491c1e /src/com/android/launcher3/allapps
parent32f91ab991dd2a1c6c0054c86b8700f2b966fd36 (diff)
downloadandroid_packages_apps_Trebuchet-1502c673d022ced571382e23302eb4a0aba72f9c.tar.gz
android_packages_apps_Trebuchet-1502c673d022ced571382e23302eb4a0aba72f9c.tar.bz2
android_packages_apps_Trebuchet-1502c673d022ced571382e23302eb4a0aba72f9c.zip
Prevent the work mode switch thumb from being dragged.
When we normally press the work mode switch, it waits for the profile to receive the ACTION_MANAGED_PROFILE_AVAILABLE broadcast before the button UI actually toggles. The user never interacts directly with that switch. However, dragging the switch thumb used to bypass that logic. This CL makes sure dragging the switch thumb cannot happen in the first place. Change-Id: Ib3b4ae7591136c35e6d02783387d752e246cfb5b Fixes: 111211805 Test: Manual
Diffstat (limited to 'src/com/android/launcher3/allapps')
-rw-r--r--src/com/android/launcher3/allapps/WorkModeSwitch.java6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/com/android/launcher3/allapps/WorkModeSwitch.java b/src/com/android/launcher3/allapps/WorkModeSwitch.java
index e7cf09209..d529f6fb5 100644
--- a/src/com/android/launcher3/allapps/WorkModeSwitch.java
+++ b/src/com/android/launcher3/allapps/WorkModeSwitch.java
@@ -20,6 +20,7 @@ import android.os.AsyncTask;
import android.os.Process;
import android.os.UserHandle;
import android.util.AttributeSet;
+import android.view.MotionEvent;
import android.widget.Switch;
import com.android.launcher3.compat.UserManagerCompat;
@@ -60,6 +61,11 @@ public class WorkModeSwitch extends Switch {
setEnabled(true);
}
+ @Override
+ public boolean onTouchEvent(MotionEvent ev) {
+ return ev.getActionMasked() == MotionEvent.ACTION_MOVE || super.onTouchEvent(ev);
+ }
+
private void trySetQuietModeEnabledToAllProfilesAsync(boolean enabled) {
new AsyncTask<Void, Void, Boolean>() {