start of WindowManagerService

start of WindowManagerService
frameworks/base/services/java/com/android/server/SystemServer.java
class ServerThread extends Thread { 
    …… 
 
    @Override 
    public void run() { 
        …… 
        WindowManagerService wm = null;
        …… 
 
        // Critical services… 
        try { 
            …… 
            Slog.i(TAG, “Window Manager”);
            wm = WindowManagerService.main(context, power,
                    factoryTest != SystemServer.FACTORY_TEST_LOW_LEVEL);
            ServiceManager.addService(Context.WINDOW_SERVICE, wm);

            ((ActivityManagerService)ServiceManager.getService(“activity”))
                    .setWindowManager(wm);
            …… 
        } catch (RuntimeException e) { 
            Slog.e(“System”, “Failure starting core service”, e); 
        } 
 
        …… 
    } 
 
    …… 

frameworks\base\services\java\com\android\server\WindowManagerService.java
    public static WindowManagerService main(Context context,
            PowerManagerService pm, boolean haveInputMethods) {
        WMThread thr = new WMThread(context, pm, haveInputMethods);
        thr.start();

        synchronized (thr) {
            while (thr.mService == null) {
                try {
                    thr.wait();
                } catch (InterruptedException e) {
                }
            }
        }

        return thr.mService;
    }

frameworks\base\core\java\android\os\Looper.java

frameworks\base\services\java\com\android\server\WindowManagerService.java
    private WindowManagerService(Context context, PowerManagerService pm,
            boolean haveInputMethods) {
        mContext = context;
        mHaveInputMethods = haveInputMethods;
        mLimitedAlphaCompositing = context.getResources().getBoolean(
                com.android.internal.R.bool.config_sf_limitedAlpha);

        mPowerManager = pm;
        mPowerManager.setPolicy(mPolicy);
        PowerManager pmc = (PowerManager)context.getSystemService(Context.POWER_SERVICE);
        mScreenFrozenLock = pmc.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK,
                “SCREEN_FROZEN”);
        mScreenFrozenLock.setReferenceCounted(false);

        mActivityManager = ActivityManagerNative.getDefault();
        mBatteryStats = BatteryStatsService.getService();

        // Get persisted window scale setting
        mWindowAnimationScale = Settings.System.getFloat(context.getContentResolver(),
                Settings.System.WINDOW_ANIMATION_SCALE, mWindowAnimationScale);
        mTransitionAnimationScale = Settings.System.getFloat(context.getContentResolver(),
                Settings.System.TRANSITION_ANIMATION_SCALE, mTransitionAnimationScale);

        // Track changes to DevicePolicyManager state so we can enable/disable keyguard.
        IntentFilter filter = new IntentFilter();
        filter.addAction(DevicePolicyManager.ACTION_DEVICE_POLICY_MANAGER_STATE_CHANGED);
        mContext.registerReceiver(mBroadcastReceiver, filter);

        mHoldingScreenWakeLock = pmc.newWakeLock(PowerManager.SCREEN_BRIGHT_WAKE_LOCK,
                “KEEP_SCREEN_ON_FLAG”);
        mHoldingScreenWakeLock.setReferenceCounted(false);

        mInputManager = new InputManager(context, this);

        PolicyThread thr = new PolicyThread(mPolicy, this, context, pm);
        thr.start();

        synchronized (thr) {
            while (!thr.mRunning) {
                try {
                    thr.wait();
                } catch (InterruptedException e) {
                }
            }
        }

        mInputManager.start();

        // Add ourself to the Watchdog monitors.
        Watchdog.getInstance().addMonitor(this);
    }

 

frameworks\base\services\java\com\android\server\SystemServer.java
            Slog.i(TAG, “Activity Manager”);           
context = ActivityManagerService.main(factoryTest);

frameworks/base/core/java/android/content/Context.java

mLimitedAlphaCompositing = context.getResources().getBoolean(
com.android.internal.R.bool.config_sf_limitedAlpha);
// to get the config
http://book.51cto.com/art/201207/348776.htm
http://en.wikipedia.org/wiki/Alpha_transparency

frameworks\base\services\java\com\android\server\WindowManagerService.java
mLimitedAlphaCompositing = context.getResources().getBoolean(
com.android.internal.R.bool.config_sf_limitedAlpha);
config_sf_limitedAlpha
          Flag indicating whether the surface flinger has limited alpha compositing functionality in hardware.
http://developer.oesf.biz/em/developer/reference/blueberry/com/android/internal/R.bool.html

 

there should be a java windowmanagerservice and a native windowmanagerservice in the new ARCH. In case native windowmanagerservice needs something from the java service, it can ask the java brother to help.

 

    原文作者:llrraa2010
    原文地址: https://blog.csdn.net/llrraa2010/article/details/7830918
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞