mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-03-01 00:06:47 +00:00
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
This commit is contained in:
@@ -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>() {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user