Hide apps with NETWORK_SETTINGS from special wifi settings

A recent change is made in the wifi framework to allow apps with
NETWORK_SETTINGS permission to bypass checks for the CHANGE_WIFI_STATE
permission. Remove apps with NETWORK_SETTINGS permission from
the list because turning off CHANGE_WIFI_STATE for those apps will not
do anything.

Bug: 78228349
Test: compile, robo test
Manual test:
flash
go to Settings -> Apps & notifications -> Advanced -> Special app access
-> Wi-Fi control
Verify that the "Settings" app is no longer in the list
Top right corner -> show system
Verify that "System UI" is no longer in the list
Change-Id: Ia430a6fb4d5dee534a03609ad1877976204935b2
This commit is contained in:
xshu
2018-04-19 17:36:46 -07:00
parent e898c75844
commit 0aabe7f3a8
2 changed files with 27 additions and 0 deletions

View File

@@ -16,6 +16,10 @@
package com.android.settings.wifi;
import static com.google.common.truth.Truth.assertThat;
import static org.mockito.Mockito.mock;
import android.content.pm.PackageInfo;
import android.Manifest;
import com.android.settings.testutils.SettingsRobolectricTestRunner;
import com.android.settingslib.applications.ApplicationsState.AppEntry;
@@ -66,4 +70,14 @@ public class AppStateChangeWifiStateBridgeTest {
mEntry.extraInfo = mState;
assertThat(mFilter.filterApp(mEntry)).isFalse();
}
@Test
public void testFilterApp_networkSettingsGranted_returnFalse() {
mState.permissionDeclared = true;
mState.packageInfo = mock(PackageInfo.class);
mState.packageInfo.requestedPermissions
= new String[]{ Manifest.permission.NETWORK_SETTINGS };
mEntry.extraInfo = mState;
assertThat(mFilter.filterApp(mEntry)).isFalse();
}
}