use of android.content.res.Configuration in project android_frameworks_base by DirtyUnicorns.
the class BasePrintTest method tearDown.
@Override
public void tearDown() throws Exception {
if (!supportsPrinting()) {
return;
}
// Done with the activity.
getActivity().finish();
enableImes();
// Restore the locale if needed.
if (mOldLocale != null) {
Resources resources = getInstrumentation().getTargetContext().getResources();
DisplayMetrics displayMetrics = resources.getDisplayMetrics();
Configuration newConfiguration = new Configuration(resources.getConfiguration());
newConfiguration.setLocales(mOldLocale);
mOldLocale = null;
resources.updateConfiguration(newConfiguration, displayMetrics);
}
// Make sure the spooler is cleaned, this also un-approves all services
clearPrintSpoolerData();
super.tearDown();
}
use of android.content.res.Configuration in project android_frameworks_base by DirtyUnicorns.
the class Am method runGetConfig.
private void runGetConfig() throws Exception {
int days = 14;
String option = nextOption();
if (option != null) {
if (!option.equals("--days")) {
throw new IllegalArgumentException("unrecognized option " + option);
}
days = Integer.parseInt(nextArgRequired());
if (days <= 0) {
throw new IllegalArgumentException("--days must be a positive integer");
}
}
try {
Configuration config = mAm.getConfiguration();
if (config == null) {
System.err.println("Activity manager has no configuration");
return;
}
System.out.println("config: " + Configuration.resourceQualifierString(config));
System.out.println("abi: " + TextUtils.join(",", Build.SUPPORTED_ABIS));
final List<Configuration> recentConfigs = getRecentConfigurations(days);
final int recentConfigSize = recentConfigs.size();
if (recentConfigSize > 0) {
System.out.println("recentConfigs:");
}
for (int i = 0; i < recentConfigSize; i++) {
System.out.println(" config: " + Configuration.resourceQualifierString(recentConfigs.get(i)));
}
} catch (RemoteException e) {
}
}
use of android.content.res.Configuration in project android_frameworks_base by DirtyUnicorns.
the class Am method runSupportsMultiwindow.
private void runSupportsMultiwindow() throws Exception {
// system resources does not contain all the device configuration, construct it manually.
Configuration config = mAm.getConfiguration();
if (config == null) {
throw new AndroidException("Activity manager has no configuration");
}
final DisplayMetrics metrics = new DisplayMetrics();
metrics.setToDefaults();
Resources res = new Resources(AssetManager.getSystem(), metrics, config);
System.out.println(res.getBoolean(com.android.internal.R.bool.config_supportsMultiWindow));
}
use of android.content.res.Configuration in project android_frameworks_base by DirtyUnicorns.
the class ActionBarPolicy method hasEmbeddedTabs.
public boolean hasEmbeddedTabs() {
final int targetSdk = mContext.getApplicationInfo().targetSdkVersion;
if (targetSdk >= Build.VERSION_CODES.JELLY_BEAN) {
return mContext.getResources().getBoolean(R.bool.action_bar_embed_tabs);
}
// The embedded tabs policy changed in Jellybean; give older apps the old policy
// so they get what they expect.
final Configuration configuration = mContext.getResources().getConfiguration();
final int width = configuration.screenWidthDp;
final int height = configuration.screenHeightDp;
return configuration.orientation == Configuration.ORIENTATION_LANDSCAPE || width >= 480 || (width >= 640 && height >= 480);
}
use of android.content.res.Configuration in project android_frameworks_base by DirtyUnicorns.
the class InputMethodUtilsTest method createTargetContextWithLocales.
private Context createTargetContextWithLocales(final LocaleList locales) {
final Configuration resourceConfiguration = new Configuration();
resourceConfiguration.setLocales(locales);
return getInstrumentation().getTargetContext().createConfigurationContext(resourceConfiguration);
}
Aggregations