Add restricted settings UI in Settings accessibility screeen

If OP_ACCESS_RESTRICTED_SETTINGS is rejected, it means accessibility page
for that app is gray out and app info won't show "unlock restricted settings menu"

If OP_ACCESS_RESTRICTED_SETTINGS is ignored, it means accessibility page
for that app is gray out, but app info shows "unlock restricted settings menu"

If OP_ACCESS_RESTRICTED_SETTINGS is allowed(default), it means users can
access accessibility page for that app.

OP_ACCESS_RESTRICTED_SETTINGS will be changed to ignored if user visited
the restricted settings dialog.

OP_ACCESS_RESTRICTED_SETTINGS will be changed to allowed if user passes
the confirmation screen.

Bug: 202130031
Test: Tested the UI and it works correctly
Change-Id: I3dfb94cee440658b4726a1c3f7265f93cd19ed3e
This commit is contained in:
Ricky Wai
2022-01-25 23:04:26 +00:00
parent 8b8b06404c
commit c76a11f0c1
11 changed files with 315 additions and 25 deletions

View File

@@ -22,6 +22,7 @@ import static com.android.internal.accessibility.AccessibilityShortcutController
import static com.google.common.truth.Truth.assertThat;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyInt;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.verify;
@@ -134,7 +135,7 @@ public class AccessibilityDetailsSettingsFragmentTest {
final Intent intent = new Intent();
intent.putExtra(Intent.EXTRA_COMPONENT_NAME, COMPONENT_NAME);
doReturn(intent).when(mActivity).getIntent();
doReturn(false).when(mFragment).isServiceAllowed(any());
doReturn(false).when(mFragment).isServiceAllowed(anyInt(), any());
mFragment.onCreate(Bundle.EMPTY);

View File

@@ -368,6 +368,7 @@ public class AccessibilitySettingsTest {
private void setMockAccessibilityShortcutInfo(AccessibilityShortcutInfo mockInfo) {
final ActivityInfo activityInfo = Mockito.mock(ActivityInfo.class);
activityInfo.applicationInfo = new ApplicationInfo();
when(mockInfo.getActivityInfo()).thenReturn(activityInfo);
when(activityInfo.loadLabel(any())).thenReturn(DEFAULT_LABEL);
when(mockInfo.loadSummary(any())).thenReturn(DEFAULT_SUMMARY);