RK3568 Android 11強制所有應用橫屏展示
1、打開frameworks/base/core/java/android/content/pm/parsing/component/ParsedActivityUtils.java文件,定位到parseActivityOrReceiver方法的int screenOrientation = sa.getInt(R.styleable.AndroidManifestActivity_screenOrientation, SCREEN_ORIENTATION_UNSPECIFIED);這一行,注釋掉該行并添加如下代碼:
// int screenOrientation = sa.getInt(R.styleable.AndroidManifestActivity_screenOrientation, SCREEN_ORIENTATION_UNSPECIFIED); // Edit by jgduan int screenOrientation; if(pkg.getSharedUserId() == null){ screenOrientation = 0; } else { screenOrientation = sa.getInt(R.styleable.AndroidManifestActivity_screenOrientation, SCREEN_ORIENTATION_UNSPECIFIED); } // End
2、打開frameworks/base/core/java/android/app/Activity.java文件,對setRequestedOrientation方法進行如下修改:
/** * Change the desired orientation of this activity. If the activity * is currently in the foreground or otherwise impacting the screen * orientation, the screen will immediately be changed (possibly causing * the activity to be restarted). Otherwise, this will be used the next * time the activity is visible. * * @param requestedOrientation An orientation constant as used in * {@link ActivityInfo#screenOrientation ActivityInfo.screenOrientation}. */ public void setRequestedOrientation(@ActivityInfo.ScreenOrientation int requestedOrientation) { if (mParent == null) { try { // Edit by jgduan //ActivityTaskManager.getService().setRequestedOrientation( // mToken, requestedOrientation); if(mApplication != null && mApplication.getApplicationInfo() != null && mApplication.getApplicationInfo().uid > 10000){ ActivityTaskManager.getService().setRequestedOrientation( mToken, ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); } else { ActivityTaskManager.getService().setRequestedOrientation( mToken, requestedOrientation); } // End } catch (RemoteException e) { // Empty } } else { // Edit by jgduan // mParent.setRequestedOrientation(requestedOrientation); if(mApplication != null && mApplication.getApplicationInfo() != null && mApplication.getApplicationInfo().uid > 10000){ mParent.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); }else{ mParent.setRequestedOrientation(requestedOrientation); } // End } }
-
開發(fā)板
+關注
關注
26文章
6346瀏覽量
119499 -
安卓
+關注
關注
5文章
2186瀏覽量
60451 -
RK3568
+關注
關注
5文章
650瀏覽量
8047
發(fā)布評論請先 登錄
RK3568開發(fā)板教程:以iTOP-RK3568開發(fā)板為例 Android13通過CIFS協(xié)議掛載Windows共享目錄
【北京迅為】itop-rk3568開發(fā)板官方Android11移植教程
iTOP-RK3568開發(fā)板Android11設置語言和默認時區(qū)
toybrick_RK3568X開發(fā)板:跑通 android 開發(fā)流程
【ROC-RK3568-PC開發(fā)板試用體驗】Firefly ROC-RK3568-PC開發(fā)板初探
迅為iTOP-RK3568開發(fā)板Android11移植之源碼結構簡介
【迅為工業(yè)RK3568穩(wěn)定可靠】itop-3568開發(fā)板Linux驅動開發(fā)實戰(zhàn):RK3568內核模塊符號導出詳解
如何基于開發(fā)板RK3568 Android 11強制所有應用橫屏展示
評論