微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

android.content.res.CompatibilityInfo的实例源码

项目:droidel    文件ActivityThread.java   
public final LoadedApk getPackageInfo(ApplicationInfo ai,CompatibilityInfo compatInfo,int flags) {
    boolean includeCode = (flags&Context.CONTEXT_INCLUDE_CODE) != 0;
    boolean securityViolation = includeCode && ai.uid != 0
            && ai.uid != Process.SYstem_UID && (mBoundApplication != null
                    ? !UserHandle.isSameApp(ai.uid,mBoundApplication.appInfo.uid)
                    : true);
    if ((flags&(Context.CONTEXT_INCLUDE_CODE
            |Context.CONTEXT_IGnorE_Security))
            == Context.CONTEXT_INCLUDE_CODE) {
        if (securityViolation) {
            String msg = "Requesting code from " + ai.packageName
                    + " (with uid " + ai.uid + ")";
            if (mBoundApplication != null) {
                msg = msg + " to be run in process "
                    + mBoundApplication.processName + " (with uid "
                    + mBoundApplication.appInfo.uid + ")";
            }
            throw new SecurityException(msg);
        }
    }
    return getPackageInfo(ai,compatInfo,null,securityViolation,includeCode);
}
项目:droidel    文件ActivityThread.java   
public ContextImpl getSystemContext() {
    synchronized (this) {
        if (mSystemContext == null) {
            ContextImpl context =
                ContextImpl.createSystemContext(this);
            LoadedApk info = new LoadedApk(this,"android",context,CompatibilityInfo.DEFAULT_COMPATIBILITY_INFO);
            context.init(info,this);
            context.getResources().updateConfiguration(mResourcesManager.getConfiguration(),mResourcesManager.getdisplayMetricslocked(display.DEFAULT_disPLAY));
            mSystemContext = context;
            //Slog.i(TAG,"Created system resources " + context.getResources()
            //        + ": " + context.getResources().getConfiguration());
        }
    }
    return mSystemContext;
}
项目:Chameleon    文件ChameleonResourcesManager.java   
@Override
public Resources getTopLevelResources(String resDir,String[] splitResDirs,String[] overlayDirs,String[] libDirs,int displayId,Configuration overrideConfiguration,IBinder token) {
    Resources resources = super.getTopLevelResources(resDir,splitResDirs,overlayDirs,libDirs,displayId,overrideConfiguration,token);
    return getTopLevelResources(resources);
}
项目:droidel    文件ActivityThread.java   
public final void scheduleLaunchActivity(Intent intent,IBinder token,int ident,ActivityInfo info,Configuration curConfig,int procState,Bundle state,List<ResultInfo> pendingResults,List<Intent> pendingNewIntents,boolean notResumed,boolean isForward,String profileName,ParcelFileDescriptor profileFd,boolean autoStopProfiler) {

    updateProcessstate(procState,false);

    ActivityClientRecord r = new ActivityClientRecord();

    r.token = token;
    r.ident = ident;
    r.intent = intent;
    r.activityInfo = info;
    r.compatInfo = compatInfo;
    r.state = state;

    r.pendingResults = pendingResults;
    r.pendingIntents = pendingNewIntents;

    r.startsNotResumed = notResumed;
    r.isForward = isForward;

    r.profileFile = profileName;
    r.profileFd = profileFd;
    r.autoStopProfiler = autoStopProfiler;

    updatePendingConfiguration(curConfig);

    sendMessage(H.LAUNCH_ACTIVITY,r);
}
项目:droidel    文件ActivityThread.java   
public final void scheduleReceiver(Intent intent,int resultCode,String data,Bundle extras,boolean sync,int sendingUser,int processstate) {
    updateProcessstate(processstate,false);
    ReceiverData r = new ReceiverData(intent,resultCode,data,extras,sync,false,mAppThread.asBinder(),sendingUser);
    r.info = info;
    r.compatInfo = compatInfo;
    sendMessage(H.RECEIVER,r);
}
项目:droidel    文件ActivityThread.java   
public final void scheduleCreateBackupAgent(ApplicationInfo app,int backupMode) {
    CreateBackupAgentData d = new CreateBackupAgentData();
    d.appInfo = app;
    d.compatInfo = compatInfo;
    d.backupMode = backupMode;

    sendMessage(H.CREATE_BACKUP_AGENT,d);
}
项目:droidel    文件ActivityThread.java   
public final void scheduleDestroyBackupAgent(ApplicationInfo app,CompatibilityInfo compatInfo) {
    CreateBackupAgentData d = new CreateBackupAgentData();
    d.appInfo = app;
    d.compatInfo = compatInfo;

    sendMessage(H.DESTROY_BACKUP_AGENT,d);
}
项目:droidel    文件ActivityThread.java   
public final void scheduleCreateService(IBinder token,ServiceInfo info,false);
    CreateServiceData s = new CreateServiceData();
    s.token = token;
    s.info = info;
    s.compatInfo = compatInfo;

    sendMessage(H.CREATE_SERVICE,s);
}
项目:droidel    文件ActivityThread.java   
public final void bindApplication(String processName,ApplicationInfo appInfo,List<ProviderInfo> providers,ComponentName instrumentationName,String profileFile,boolean autoStopProfiler,Bundle instrumentationArgs,IInstrumentationWatcher instrumentationWatcher,iuiAutomationConnection instrumentationUiConnection,int debugMode,boolean enableOpenGlTrace,boolean isRestrictedBackupMode,boolean persistent,Configuration config,Map<String,IBinder> services,Bundle coreSettings) {

    if (services != null) {
        // Setup the service cache in the ServiceManager
        ServiceManager.initServiceCache(services);
    }

    setCoreSettings(coreSettings);

    AppBindData data = new AppBindData();
    data.processName = processName;
    data.appInfo = appInfo;
    data.providers = providers;
    data.instrumentationName = instrumentationName;
    data.instrumentationArgs = instrumentationArgs;
    data.instrumentationWatcher = instrumentationWatcher;
    data.instrumentationUiAutomationConnection = instrumentationUiConnection;
    data.debugMode = debugMode;
    data.enableOpenGlTrace = enableOpenGlTrace;
    data.restrictedBackupMode = isRestrictedBackupMode;
    data.persistent = persistent;
    data.config = config;
    data.compatInfo = compatInfo;
    data.initProfileFile = profileFile;
    data.initProfileFd = profileFd;
    data.initAutoStopProfiler = false;
    sendMessage(H.BIND_APPLICATION,data);
}
项目:droidel    文件ActivityThread.java   
Configuration applyConfigCompatMainThread(int displayDensity,CompatibilityInfo compat) {
    if (config == null) {
        return null;
    }
    if (!compat.supportsScreen()) {
        mMainThreadConfig.setTo(config);
        config = mMainThreadConfig;
        compat.applyToConfiguration(displayDensity,config);
    }
    return config;
}
项目:droidel    文件ActivityThread.java   
private LoadedApk getPackageInfo(ApplicationInfo aInfo,ClassLoader baseLoader,boolean securityViolation,boolean includeCode) {
    synchronized (mResourcesManager) {
        WeakReference<LoadedApk> ref;
        if (includeCode) {
            ref = mPackages.get(aInfo.packageName);
        } else {
            ref = mResourcePackages.get(aInfo.packageName);
        }
        LoadedApk packageInfo = ref != null ? ref.get() : null;
        if (packageInfo == null || (packageInfo.mResources != null
                && !packageInfo.mResources.getAssets().isUpToDate())) {
            if (localLOGV) Slog.v(TAG,(includeCode ? "Loading code package "
                    : "Loading resource-only package ") + aInfo.packageName
                    + " (in " + (mBoundApplication != null
                            ? mBoundApplication.processName : null)
                    + ")");
            packageInfo =
                new LoadedApk(this,aInfo,this,baseLoader,includeCode &&
                        (aInfo.flags&ApplicationInfo.FLAG_HAS_CODE) != 0);
            if (includeCode) {
                mPackages.put(aInfo.packageName,new WeakReference<LoadedApk>(packageInfo));
            } else {
                mResourcePackages.put(aInfo.packageName,new WeakReference<LoadedApk>(packageInfo));
            }
        }
        return packageInfo;
    }
}
项目:droidel    文件ActivityThread.java   
public void installSystemApplicationInfo(ApplicationInfo info) {
    synchronized (this) {
        ContextImpl context = getSystemContext();
        context.init(new LoadedApk(this,info,CompatibilityInfo.DEFAULT_COMPATIBILITY_INFO),this);

        // give ourselves a default profiler
        mProfiler = new Profiler();
    }
}
项目:droidel    文件ActivityThread.java   
public void updatePackageCompatibilityInfo(String pkg,CompatibilityInfo info) {
    UpdateCompatibilityData ucd = new UpdateCompatibilityData();
    ucd.pkg = pkg;
    ucd.info = info;
    sendMessage(H.UPDATE_PACKAGE_COMPATIBILITY_INFO,ucd);
}
项目:droidel    文件ActivityThread.java   
public final LoadedApk getPackageInfo(String packageName,int flags) {
    return getPackageInfo(packageName,flags,UserHandle.myUserId());
}
项目:droidel    文件ActivityThread.java   
public final LoadedApk getPackageInfo(String packageName,int flags,int userId) {
    synchronized (mResourcesManager) {
        WeakReference<LoadedApk> ref;
        if ((flags&Context.CONTEXT_INCLUDE_CODE) != 0) {
            ref = mPackages.get(packageName);
        } else {
            ref = mResourcePackages.get(packageName);
        }
        LoadedApk packageInfo = ref != null ? ref.get() : null;
        //Slog.i(TAG,"getPackageInfo " + packageName + ": " + packageInfo);
        //if (packageInfo != null) Slog.i(TAG,"isUptoDate " + packageInfo.mResDir
        //        + ": " + packageInfo.mResources.getAssets().isUpToDate());
        if (packageInfo != null && (packageInfo.mResources == null
                || packageInfo.mResources.getAssets().isUpToDate())) {
            if (packageInfo.isSecurityViolation()
                    && (flags&Context.CONTEXT_IGnorE_Security) == 0) {
                throw new SecurityException(
                        "Requesting code from " + packageName
                        + " to be run in process "
                        + mBoundApplication.processName
                        + "/" + mBoundApplication.appInfo.uid);
            }
            return packageInfo;
        }
    }

    ApplicationInfo ai = null;
    try {
        ai = getPackageManager().getApplicationInfo(packageName,PackageManager.GET_SHARED_LIBRARY_FILES,userId);
    } catch (remoteexception e) {
        // Ignore
    }

    if (ai != null) {
        return getPackageInfo(ai,flags);
    }

    return null;
}
项目:droidel    文件ActivityThread.java   
public final LoadedApk getPackageInfoNoCheck(ApplicationInfo ai,CompatibilityInfo compatInfo) {
    return getPackageInfo(ai,true);
}
项目:droidel    文件ActivityThread.java   
final void handleConfigurationChanged(Configuration config,CompatibilityInfo compat) {

        int configDiff = 0;

        synchronized (mResourcesManager) {
            if (mPendingConfiguration != null) {
                if (!mPendingConfiguration.isOtherSeqNewer(config)) {
                    config = mPendingConfiguration;
                    mCurDefaultdisplayDpi = config.densityDpi;
                    updateDefaultDensity();
                }
                mPendingConfiguration = null;
            }

            if (config == null) {
                return;
            }

            if (DEBUG_CONfigURATION) Slog.v(TAG,"Handle configuration changed: "
                    + config);

            mResourcesManager.applyConfigurationToResourcesLocked(config,compat);

            if (mConfiguration == null) {
                mConfiguration = new Configuration();
            }
            if (!mConfiguration.isOtherSeqNewer(config) && compat == null) {
                return;
            }
            configDiff = mConfiguration.diff(config);
            mConfiguration.updateFrom(config);
            config = applyCompatConfiguration(mCurDefaultdisplayDpi);
        }

        ArrayList<ComponentCallbacks2> callbacks = collectComponentCallbacks(false,config);

        // Cleanup hardware accelerated stuff
        WindowManagerGlobal.getInstance().trimLocalMemory();

        freeTextLayoutCachesIfNeeded(configDiff);

        if (callbacks != null) {
            final int N = callbacks.size();
            for (int i=0; i<N; i++) {
                performConfigurationChanged(callbacks.get(i),config);
            }
        }
    }

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。