Android6.0 Launcher3 拖拽分析
http://blog.csdn.net/yinyuerenzhangwenda/article/details/52398632
Launcher : onLongClick showOverviewMode getWidgetsView bindAllPackages(mWidgetsView.addWidgets(model);) setupViews(mOverviewPanel settings_button) onClickSettingsButton(startActivity(new Intent(this, SettingsActivity.class)); onPreferenceChange(LauncherSettings.Settings.EXTRA_VALUE = "value")
onSettingsChanged(mUpdateOrientationRunnable.run()) setOrientation unlockScreenOrientation(true) setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED)
Activity : setRequestedOrientation ActivityManagerNative.getDefault().setRequestedOrientation(mToken, requestedOrientation);
ActivityManagerService : setRequestedOrientation(mWindowManager.setAppOrientation(r.appToken, requestedOrientation);)
WindowManagerService : setAppOrientation(atoken.requestedOrientation = requestedOrientation;)
(Launcher3)SettingsActivity :
LauncherProvider : call(case LauncherSettings.Settings.METHOD_SET_BOOLEAN: mListener.onSettingsChanged(arg, value);) setLauncherProviderChangeListener(mListener)
LauncherAppState : setLauncher(getLauncherProvider().setLauncherProviderChangeListener(launcher))
workspace :
LauncherStateTransitionAnimation : startAnimationToWorkspace mLauncher.getWidgetsView
设置中“自动转屏“设置跟app中Activity设置横竖屏之间的影响
http://blog.csdn.net/xxxsz/article/details/8199039
对于横竖屏设置,网上介绍的很多,这里主要说下系统设置中“自动转屏“设置跟
app中Activity设置横竖屏之间的影响:
现说下下面两点
1:优先级:Activity设置横竖屏 高于 系统设置中“自动转屏“设置;
2:Activity的横竖屏设置信息是保存在ActivityINfo对象中,ActivityINfo的横
竖屏默认值是 screenOrientation = SCREEN_ORIENTATION_UNSPECIFIED而不是
SCREEN_ORIENTATION_SENSOR。
基于以上两点可以衍生出以下几点(经过代码验证):
1、只有当Activity持有的对象ActivityINfo:screenOrientation =
SCREEN_ORIENTATION_UNSPECIFIED时,系统设置中“自动转屏“设置才会对APP中的
Activity窗口显示起作用;
2、当Activity需要自由设置横竖屏状态,且已经通过setRequestedOrientation设
置后,又想恢复自动转屏交由系统控制,此时应该
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
而不是
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR);