use of org.robolectric.annotation.HiddenApi in project robolectric by robolectric.
the class ShadowAccessibilityManager method getInstance.
@HiddenApi
@Implementation
public static AccessibilityManager getInstance(Context context) throws Exception {
if (getApiLevel() >= KITKAT) {
AccessibilityManager accessibilityManager = Shadow.newInstance(AccessibilityManager.class, new Class[] { Context.class, IAccessibilityManager.class, int.class }, new Object[] { context, new AccessibilityManagerService(context), 0 });
ReflectionHelpers.setField(accessibilityManager, "mHandler", new MyHandler(context.getMainLooper(), accessibilityManager));
return accessibilityManager;
} else {
AccessibilityManager accessibilityManager = Shadow.newInstance(AccessibilityManager.class, new Class[0], new Object[0]);
ReflectionHelpers.setField(accessibilityManager, "mHandler", new MyHandler(context.getMainLooper(), accessibilityManager));
return accessibilityManager;
}
}
use of org.robolectric.annotation.HiddenApi in project robolectric by robolectric.
the class ShadowAppWidgetManager method bindAppWidgetId.
@HiddenApi
@Implementation
public void bindAppWidgetId(int appWidgetId, ComponentName provider) {
WidgetInfo widgetInfo = new WidgetInfo(provider);
widgetInfos.put(appWidgetId, widgetInfo);
for (AppWidgetProviderInfo appWidgetProviderInfo : installedProviders) {
if (provider != null && provider.equals(appWidgetProviderInfo.provider)) {
widgetInfo.info = appWidgetProviderInfo;
}
}
}
use of org.robolectric.annotation.HiddenApi in project robolectric by robolectric.
the class ShadowAssetManager method applyThemeStyle.
@HiddenApi
@Implementation(minSdk = LOLLIPOP)
public static void applyThemeStyle(long themePtr, int styleRes, boolean force) {
NativeTheme nativeTheme = getNativeTheme(themePtr);
Style style = nativeTheme.getShadowAssetManager().resolveStyle(styleRes, null);
nativeTheme.themeStyleSet.apply(style, force);
}
use of org.robolectric.annotation.HiddenApi in project robolectric by robolectric.
the class ShadowAssetManager method openNonAsset.
@HiddenApi
@Implementation
public final InputStream openNonAsset(int cookie, String fileName, int accessMode) throws IOException {
final ResName resName = qualifyFromNonAssetFileName(fileName);
final FileTypedResource typedResource = (FileTypedResource) resourceTable.getValue(resName, RuntimeEnvironment.getQualifiers());
if (typedResource == null) {
throw new IOException("Unable to find resource for " + fileName);
}
if (accessMode == AssetManager.ACCESS_STREAMING) {
return typedResource.getFsFile().getInputStream();
} else {
return new ByteArrayInputStream(typedResource.getFsFile().getBytes());
}
}
use of org.robolectric.annotation.HiddenApi in project robolectric by robolectric.
the class ShadowAssetManager method getResourceValue.
@HiddenApi
@Implementation
public boolean getResourceValue(int ident, int density, TypedValue outValue, boolean resolveRefs) {
TypedResource value = getAndResolve(ident, RuntimeEnvironment.getQualifiers(), resolveRefs);
if (value == null)
return false;
getConverter(value).fillTypedValue(value.getData(), outValue);
return true;
}
Aggregations