Check a flag to see whether or not to show permission usage information.

Bug: 122615235
Test: Manually set/unset flag, see/don't see usage information.
Change-Id: I2d743fc28c5676a2304dac73ae96734241f3fe1d
This commit is contained in:
Joel Galenson
2019-01-24 08:14:09 -08:00
parent b73db4c988
commit 6bf75d288d
6 changed files with 71 additions and 9 deletions

View File

@@ -19,21 +19,32 @@ package com.android.settings.testutils.shadow;
import org.robolectric.annotation.Config;
import org.robolectric.annotation.Implementation;
import org.robolectric.annotation.Implements;
import org.robolectric.annotation.Resetter;
import java.util.HashMap;
import java.util.Map;
@Implements(android.provider.DeviceConfig.class)
public class ShadowDeviceConfig {
private static String configValue;
private static Map<String, String> sPropertyMaps = new HashMap<>();
@Resetter
public static void reset() {
sPropertyMaps.clear();
}
@Implementation
protected static boolean setProperty(
String namespace, String name, String value, boolean makeDefault) {
configValue = value;
public static boolean setProperty(
String namespace, String name, String value, boolean makeDefault) {
sPropertyMaps.put(name, value);
return true;
}
@Implementation
protected static String getProperty(String ns, String key) { return configValue; }
public static String getProperty(String namespace, String name) {
return sPropertyMaps.get(name);
}
}