Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4794b798 authored by Sunny Shao's avatar Sunny Shao
Browse files

Fix toggle widget can be switched under overlapped view

- ag/11612781 added filterTouchesWhenObscured to toggle widget
  can't prevent the click behavior pass through the overlapped view.
- Due to click events was handled by SwitchPreference instead of the
  toggle widget.
- Enable the filterTouchesWhenObscured attribute on all
  SwitchPreferences in all pages of the special app access.


Bug: 155288585
Test: manual test
Here is the test steps
  1.Create an overlapped view's app and launch it to overlap the
    other apps.
  2.Launch Settings
  3.Goto Apps & notification > Advanced > Special app access
  4.Click any toggle under Special app access to monitor it can be
    switched or not. It must be not switched.
Change-Id: I9c9cf4719153292ed03f55a6eb9d3a308677aee3
parent ce1c1d37
Loading
Loading
Loading
Loading
+2 −1
Original line number Original line Diff line number Diff line
@@ -36,7 +36,8 @@ public class AppSwitchPreference extends SwitchPreference {
        super.onBindViewHolder(holder);
        super.onBindViewHolder(holder);
        final View switchView = holder.findViewById(android.R.id.switch_widget);
        final View switchView = holder.findViewById(android.R.id.switch_widget);
        if (switchView != null) {
        if (switchView != null) {
            switchView.setFilterTouchesWhenObscured(true);
            final View rootView = switchView.getRootView();
            rootView.setFilterTouchesWhenObscured(true);
        }
        }
    }
    }
}
}
+2 −1
Original line number Original line Diff line number Diff line
@@ -52,7 +52,8 @@ public class FilterTouchesRestrictedSwitchPreference extends RestrictedSwitchPre
        super.onBindViewHolder(holder);
        super.onBindViewHolder(holder);
        final View switchView = holder.findViewById(android.R.id.switch_widget);
        final View switchView = holder.findViewById(android.R.id.switch_widget);
        if (switchView != null) {
        if (switchView != null) {
            switchView.setFilterTouchesWhenObscured(true);
            final View rootView = switchView.getRootView();
            rootView.setFilterTouchesWhenObscured(true);
        }
        }
    }
    }
}
}
+2 −1
Original line number Original line Diff line number Diff line
@@ -50,7 +50,8 @@ public class FilterTouchesSwitchPreference extends SwitchPreference {
        super.onBindViewHolder(holder);
        super.onBindViewHolder(holder);
        final View switchView = holder.findViewById(android.R.id.switch_widget);
        final View switchView = holder.findViewById(android.R.id.switch_widget);
        if (switchView != null) {
        if (switchView != null) {
            switchView.setFilterTouchesWhenObscured(true);
            final View rootView = switchView.getRootView();
            rootView.setFilterTouchesWhenObscured(true);
        }
        }
    }
    }
}
}