public static android.view.WindowManager getDefault(android.content.res.CompatibilityInfo compatInfo) { android.view.CompatibilityInfoHolder cih = new android.view.CompatibilityInfoHolder (); cih.set(compatInfo); if (cih.getIfNeeded() == null) { return(sWindowManager); } lock (sLock) { // NOTE: It would be cleaner to move the implementation of // WindowManagerImpl into a static inner class, and have this // public impl just call into that. Then we can make multiple // instances of WindowManagerImpl for compat mode rather than // having to make wrappers. android.view.WindowManager wm = sCompatWindowManagers.get(compatInfo); if (wm == null) { wm = new android.view.WindowManagerImpl.CompatModeWrapper(sWindowManager, cih); sCompatWindowManagers.put(compatInfo, wm); } return(wm); } }
public override bool Equals(object o) { try { android.content.res.CompatibilityInfo oc = (android.content.res.CompatibilityInfo )o; if (mCompatibilityFlags != oc.mCompatibilityFlags) { return(false); } if (applicationDensity != oc.applicationDensity) { return(false); } if (applicationScale != oc.applicationScale) { return(false); } if (applicationInvertedScale != oc.applicationInvertedScale) { return(false); } return(true); } catch (System.InvalidCastException) { return(false); } }
/// <summary> /// Create information about a new .apk /// NOTE: This constructor is called with ActivityThread's lock held, /// so MUST NOT call back out to the activity manager. /// </summary> /// <remarks> /// Create information about a new .apk /// NOTE: This constructor is called with ActivityThread's lock held, /// so MUST NOT call back out to the activity manager. /// </remarks> public LoadedApk(android.app.ActivityThread activityThread, android.content.pm.ApplicationInfo aInfo, android.content.res.CompatibilityInfo compatInfo, android.app.ActivityThread mainThread, java.lang.ClassLoader baseLoader, bool securityViolation, bool includeCode ) { mActivityThread = activityThread; mApplicationInfo = aInfo; mPackageName = aInfo.packageName; mAppDir = aInfo.sourceDir; mResDir = aInfo.uid == android.os.Process.myUid() ? aInfo.sourceDir : aInfo.publicSourceDir; mSharedLibraries = aInfo.sharedLibraryFiles; mDataDir = aInfo.dataDir; mDataDirFile = mDataDir != null ? new java.io.File(mDataDir) : null; mLibDir = aInfo.nativeLibraryDir; mBaseClassLoader = baseLoader; mSecurityViolation = securityViolation; mIncludeCode = includeCode; mCompatibilityInfo.set(compatInfo); if (mAppDir == null) { if (android.app.ActivityThread.mSystemContext == null) { android.app.ActivityThread.mSystemContext = android.app.ContextImpl.createSystemContext (mainThread); android.app.ActivityThread.mSystemContext.getResources().updateConfiguration(mainThread .getConfiguration(), mainThread.getDisplayMetricsLocked(compatInfo, false), compatInfo ); } //Slog.i(TAG, "Created system resources " // + mSystemContext.getResources() + ": " // + mSystemContext.getResources().getConfiguration()); mClassLoader = android.app.ActivityThread.mSystemContext.getClassLoader(); mResources = android.app.ActivityThread.mSystemContext.getResources(); } }
public virtual void scheduleLaunchActivity(android.content.Intent intent, android.os.IBinder token, int ident, android.content.pm.ActivityInfo info, android.content.res.Configuration curConfig, android.content.res.CompatibilityInfo compatInfo, android.os.Bundle state, java.util.List <android.app.ResultInfo> pendingResults, java.util.List <android.content.Intent > pendingNewIntents, bool notResumed, bool isForward, string profileName, android.os.ParcelFileDescriptor profileFd, bool autoStopProfiler) { throw new System.NotImplementedException(); }
public virtual android.content.res.CompatibilityInfo getIfNeeded() { android.content.res.CompatibilityInfo ci = mCompatInfo; if (ci == null || ci == android.content.res.CompatibilityInfo.DEFAULT_COMPATIBILITY_INFO) { return(null); } return(ci); }
public virtual void bindApplication(string packageName, android.content.pm.ApplicationInfo info, java.util.List <android.content.pm.ProviderInfo> providers, android.content.ComponentName testName, string profileName, android.os.ParcelFileDescriptor profileFd, bool autoStopProfiler , android.os.Bundle testArgs, android.app.IInstrumentationWatcher testWatcher, int debugMode, bool restrictedBackupMode, bool persistent, android.content.res.Configuration config, android.content.res.CompatibilityInfo compatInfo, java.util.Map <string, android.os.IBinder> services, android.os.Bundle coreSettings) { throw new System.NotImplementedException(); }
public virtual void set(android.content.res.CompatibilityInfo compatInfo) { if (compatInfo != null && (compatInfo.isScalingRequired() || !compatInfo.supportsScreen ())) { mCompatInfo = compatInfo; } else { mCompatInfo = android.content.res.CompatibilityInfo.DEFAULT_COMPATIBILITY_INFO; } }
/// <summary>Gets display metrics that describe the size and density of this display. /// </summary> /// <remarks> /// Gets display metrics that describe the size and density of this display. /// <p> /// The size is adjusted based on the current rotation of the display. /// </p><p> /// The size returned by this method does not necessarily represent the /// actual raw size (native resolution) of the display. The returned size may /// be adjusted to exclude certain system decor elements that are always visible. /// It may also be scaled to provide compatibility with older applications that /// were originally designed for smaller displays. /// </p> /// </remarks> /// <param name="outMetrics"> /// A /// <see cref="android.util.DisplayMetrics">android.util.DisplayMetrics</see> /// object to receive the metrics. /// </param> public virtual void getMetrics(android.util.DisplayMetrics outMetrics) { lock (mTmpPoint) { getSizeInternal(mTmpPoint, false); getMetricsWithSize(outMetrics, mTmpPoint.x, mTmpPoint.y); } android.content.res.CompatibilityInfo ci = mCompatibilityInfo.getIfNeeded(); if (ci != null) { ci.applyToDisplayMetrics(outMetrics); } }
public LoadedApk(android.app.ActivityThread activityThread, string name, android.content.Context systemContext, android.content.pm.ApplicationInfo info, android.content.res.CompatibilityInfo compatInfo) { mActivityThread = activityThread; mApplicationInfo = info != null ? info : new android.content.pm.ApplicationInfo(); mApplicationInfo.packageName = name; mPackageName = name; mAppDir = null; mResDir = null; mSharedLibraries = null; mDataDir = null; mDataDirFile = null; mLibDir = null; mBaseClassLoader = null; mSecurityViolation = false; mIncludeCode = true; mClassLoader = systemContext.getClassLoader(); mResources = systemContext.getResources(); mCompatibilityInfo.set(compatInfo); }
public abstract void scheduleDestroyBackupAgent(android.content.pm.ApplicationInfo arg1, android.content.res.CompatibilityInfo arg2);
public virtual void scheduleDestroyBackupAgent(android.content.pm.ApplicationInfo app, android.content.res.CompatibilityInfo compatInfo) { throw new System.NotImplementedException(); }
public virtual void scheduleReceiver(android.content.Intent intent, android.content.pm.ActivityInfo info, android.content.res.CompatibilityInfo compatInfo, int resultCode, string resultData, android.os.Bundle map, bool sync) { throw new System.NotImplementedException(); }
public virtual void scheduleCreateService(android.os.IBinder token, android.content.pm.ServiceInfo info, android.content.res.CompatibilityInfo compatInfo) { throw new System.NotImplementedException(); }
internal bool applyConfigurationToResourcesLocked(android.content.res.Configuration config, android.content.res.CompatibilityInfo compat) { if (mResConfiguration == null) { mResConfiguration = new android.content.res.Configuration(); } if (!mResConfiguration.isOtherSeqNewer(config) && compat == null) { return false; } int changes = mResConfiguration.updateFrom(config); android.util.DisplayMetrics dm = getDisplayMetricsLocked(null, true); if (compat != null && (mResCompatibilityInfo == null || !mResCompatibilityInfo.Equals (compat))) { mResCompatibilityInfo = compat; changes |= android.content.pm.ActivityInfo.CONFIG_SCREEN_LAYOUT | android.content.pm.ActivityInfo .CONFIG_SCREEN_SIZE | android.content.pm.ActivityInfo.CONFIG_SMALLEST_SCREEN_SIZE; } // set it for java, this also affects newly created Resources if (config.locale != null) { Sharpen.Util.SetCurrentCulture(config.locale); } android.content.res.Resources.updateSystemConfiguration(config, dm, compat); android.app.ApplicationPackageManager.configurationChanged(); //Slog.i(TAG, "Configuration changed in " + currentPackageName()); java.util.Iterator<[email protected]<android.content.res.Resources>> it = mActiveResources.values().iterator(); //Iterator<Map.Entry<String, WeakReference<Resources>>> it = // mActiveResources.entrySet().iterator(); while (it.hasNext()) { [email protected]<android.content.res.Resources> v = it.next(); android.content.res.Resources r = v.get(); if (r != null) { r.updateConfiguration(config, dm, compat); } else { //Slog.i(TAG, "Updated app resources " + v.getKey() // + " " + r + ": " + r.getConfiguration()); //Slog.i(TAG, "Removing old resources " + v.getKey()); it.remove(); } } return changes != 0; }
public virtual void updatePackageCompatibilityInfo(string pkg, android.content.res.CompatibilityInfo info) { throw new System.NotImplementedException(); }
public abstract void bindApplication(string arg1, android.content.pm.ApplicationInfo arg2, java.util.List <android.content.pm.ProviderInfo> arg3, android.content.ComponentName arg4, string arg5, android.os.ParcelFileDescriptor arg6, bool arg7, android.os.Bundle arg8, android.app.IInstrumentationWatcher arg9, int arg10, bool arg11, bool arg12 , android.content.res.Configuration arg13, android.content.res.CompatibilityInfo arg14, java.util.Map <string, android.os.IBinder> arg15, android.os.Bundle arg16 );
public abstract void scheduleCreateBackupAgent(android.content.pm.ApplicationInfo arg1, android.content.res.CompatibilityInfo arg2, int arg3);
public abstract void updatePackageCompatibilityInfo(string arg1, android.content.res.CompatibilityInfo arg2);
/// <summary>Creates a new Resources object with CompatibilityInfo.</summary> /// <remarks>Creates a new Resources object with CompatibilityInfo.</remarks> /// <param name="assets">Previously created AssetManager.</param> /// <param name="metrics"> /// Current display metrics to consider when /// selecting/computing resource values. /// </param> /// <param name="config"> /// Desired device configuration to consider when /// selecting/computing resource values (optional). /// </param> /// <param name="compInfo"> /// this resource's compatibility info. It will use the default compatibility /// info when it's null. /// </param> /// <hide></hide> public Resources(android.content.res.AssetManager assets, android.util.DisplayMetrics metrics, android.content.res.Configuration config, android.content.res.CompatibilityInfo compInfo) { mAssets = assets; mMetrics.setToDefaults(); mCompatibilityInfo = compInfo; updateConfiguration(config, metrics); assets.ensureStringBlocks(); }
/// <hide></hide> public virtual void updateConfiguration(android.content.res.Configuration config, android.util.DisplayMetrics metrics, android.content.res.CompatibilityInfo compat ) { lock (mTmpValue) { if (false) { android.util.Slog.i(TAG, "**** Updating config of " + this + ": old config is " + mConfiguration + " old compat is " + mCompatibilityInfo); android.util.Slog.i(TAG, "**** Updating config of " + this + ": new config is " + config + " new compat is " + compat); } if (compat != null) { mCompatibilityInfo = compat; } if (metrics != null) { mMetrics.setTo(metrics); } // NOTE: We should re-arrange this code to create a Display // with the CompatibilityInfo that is used everywhere we deal // with the display in relation to this app, rather than // doing the conversion here. This impl should be okay because // we make sure to return a compatible display in the places // where there are public APIs to retrieve the display... but // it would be cleaner and more maintainble to just be // consistently dealing with a compatible display everywhere in // the framework. if (mCompatibilityInfo != null) { mCompatibilityInfo.applyToDisplayMetrics(mMetrics); } int configChanges = unchecked((int)(0xfffffff)); if (config != null) { mTmpConfig.setTo(config); if (mCompatibilityInfo != null) { mCompatibilityInfo.applyToConfiguration(mTmpConfig); } if (mTmpConfig.locale == null) { mTmpConfig.locale = System.Globalization.CultureInfo.CurrentCulture; } configChanges = mConfiguration.updateFrom(mTmpConfig); configChanges = android.content.pm.ActivityInfo.activityInfoConfigToNative(configChanges ); } if (mConfiguration.locale == null) { mConfiguration.locale = System.Globalization.CultureInfo.CurrentCulture; } mMetrics.scaledDensity = mMetrics.density * mConfiguration.fontScale; string locale = null; if (mConfiguration.locale != null) { locale = Sharpen.Util.GetLanguage(mConfiguration.locale); if (Sharpen.Util.GetCountry(mConfiguration.locale) != null) { locale += "-" + Sharpen.Util.GetCountry(mConfiguration.locale); } } int width; int height; if (mMetrics.widthPixels >= mMetrics.heightPixels) { width = mMetrics.widthPixels; height = mMetrics.heightPixels; } else { //noinspection SuspiciousNameCombination width = mMetrics.heightPixels; //noinspection SuspiciousNameCombination height = mMetrics.widthPixels; } int keyboardHidden = mConfiguration.keyboardHidden; if (keyboardHidden == android.content.res.Configuration.KEYBOARDHIDDEN_NO && mConfiguration .hardKeyboardHidden == android.content.res.Configuration.HARDKEYBOARDHIDDEN_YES) { keyboardHidden = android.content.res.Configuration.KEYBOARDHIDDEN_SOFT; } mAssets.setConfiguration(mConfiguration.mcc, mConfiguration.mnc, locale, mConfiguration .orientation, mConfiguration.touchscreen, (int)(mMetrics.density * 160), mConfiguration .keyboard, keyboardHidden, mConfiguration.navigation, width, height, mConfiguration .smallestScreenWidthDp, mConfiguration.screenWidthDp, mConfiguration.screenHeightDp , mConfiguration.screenLayout, mConfiguration.uiMode, android.os.Build.VERSION.RESOURCES_SDK_INT ); clearDrawableCache(mDrawableCache, configChanges); clearDrawableCache(mColorDrawableCache, configChanges); mColorStateListCache.clear(); flushLayoutCache(); } lock (mSync) { if (mPluralRule != null) { mPluralRule = libcore.icu.NativePluralRules.forLocale(config.locale); } } }
public abstract void scheduleCreateService(android.os.IBinder arg1, android.content.pm.ServiceInfo arg2, android.content.res.CompatibilityInfo arg3);
/// <summary>This is just for testing.</summary> /// <remarks>This is just for testing.</remarks> /// <hide></hide> public virtual void setCompatibilityInfo(android.content.res.CompatibilityInfo ci ) { mCompatibilityInfo = ci; updateConfiguration(mConfiguration, mMetrics); }
public abstract void scheduleLaunchActivity(android.content.Intent arg1, android.os.IBinder arg2, int arg3, android.content.pm.ActivityInfo arg4, android.content.res.Configuration arg5, android.content.res.CompatibilityInfo arg6, android.os.Bundle arg7, java.util.List <android.app.ResultInfo> arg8, java.util.List <android.content.Intent> arg9, bool arg10, bool arg11, string arg12, android.os.ParcelFileDescriptor arg13, bool arg14 );
private Resources() { mAssets = android.content.res.AssetManager.getSystem(); // NOTE: Intentionally leaving this uninitialized (all values set // to zero), so that anyone who tries to do something that requires // metrics will get a very wrong value. mConfiguration.setToDefaults(); mMetrics.setToDefaults(); updateConfiguration(null, null); mAssets.ensureStringBlocks(); mCompatibilityInfo = android.content.res.CompatibilityInfo.DEFAULT_COMPATIBILITY_INFO; }
public abstract void scheduleReceiver(android.content.Intent arg1, android.content.pm.ActivityInfo arg2, android.content.res.CompatibilityInfo arg3, int arg4, string arg5, android.os.Bundle arg6, bool arg7);