Make app predicates singleton
1. AppLabelPredicate 2. AppRestrictionPredicate Change-Id: I1fd8611c5dd7ffa6318bcb23de7a973c111910b6 Fixes: 111323520 Test: RunSettingsRoboTests
This commit is contained in:
@@ -19,6 +19,8 @@ package com.android.settings.testutils;
|
||||
import android.content.Intent;
|
||||
import android.os.BatteryManager;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
public class BatteryTestUtils {
|
||||
|
||||
public static Intent getChargingIntent() {
|
||||
@@ -47,4 +49,15 @@ public class BatteryTestUtils {
|
||||
return intent;
|
||||
}
|
||||
|
||||
public static void clearStaticInstance(Class clazz, String fieldName) {
|
||||
Field instance;
|
||||
try {
|
||||
instance = clazz.getDeclaredField(fieldName);
|
||||
instance.setAccessible(true);
|
||||
instance.set(null, null);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user