Android12 ZR 修改相册的方向

相机录像后播放视频,播放完之后在没有开自动旋转的情况,会旋转一下然后再恢复当前方向。

排查后发现被vendor\sprd\platform\packages\apps\NewGallery2目录的相册,会被vendor\unisoc_decoupling目录下的GalleryPrebuilt给覆盖掉,这个apk应该是强制竖屏的,所以把它删掉再去修改代码才有效。

1、修改方向的话,在vendor\sprd\platform\packages\apps\NewGallery2\app_discover\src\main\AndroidManifest.xml修改才有效,主要是把screenOrientation全都改成behind与前一个activity方向相同。

+++ b/vendor/sprd/platform/packages/apps/NewGallery2/app_discover/src/main/AndroidManifest.xml
@@ -210,6 +210,7 @@
             android:label="@string/app_name"
             android:resizeableActivity="false"
             android:theme="@style/GalleryV2Theme"
+             android:screenOrientation="behind"^M
             android:exported="true">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
@@ -421,7 +422,7 @@
             android:configChanges="keyboardHidden|screenLayout"
             android:label="@string/title_activity_filter_show"
             android:launchMode="singleTop"
-            android:screenOrientation="portrait"
+            android:screenOrientation="behind"^M
             android:theme="@style/Theme.FilterShow"
             android:exported="true">
             <intent-filter>
@@ -787,7 +788,7 @@
 
         <activity
             android:name="com.sprd.gallery3d.blending.ReplaceActivity"
-            android:screenOrientation="portrait"
+            android:screenOrientation="behind"^M
             android:exported="true">
             <intent-filter>
                 <action android:name="com.android.sprd.gallery3d.imageblending" />
@@ -800,7 +801,7 @@
             android:name="com.sprd.gallery3d.refocusimage.RefocusEditActivity"
             android:showWhenLocked="true"
             android:configChanges="orientation|keyboardHidden|screenSize"
-            android:screenOrientation="portrait"
+            android:screenOrientation="behind"^M
             android:theme="@style/Theme.Refocus"
             android:exported="true">
             <intent-filter>
@@ -847,13 +848,13 @@
             android:name="com.android.gallery3d.v2.app.MotionActivity"
             android:configChanges="keyboardHidden|orientation|screenSize"
             android:label="@string/prefered_motion_photo"
-            android:screenOrientation="portrait"
+            android:screenOrientation="behind"^M
             android:theme="@style/MotionTheme" />
 
         <activity
             android:name="com.sprd.gallery3d.smarterase.SmartEraseActivity"
             android:configChanges="orientation|keyboardHidden|screenSize"
-            android:screenOrientation="portrait" />
+            android:screenOrientation="behind" />^M
 
         <provider
             android:name="com.android.gallery3d.v2.media.extras.MediaExtrasProvider"
@@ -861,12 +862,12 @@
 
         <activity
             android:name="com.sprd.gallery3d.portrait.PortraitBlendActivity"
-            android:screenOrientation="portrait"
+            android:screenOrientation="behind"^M
             android:theme="@style/Theme.AppCompat.NoActionBar" />
 
         <activity
             android:name="com.sprd.gallery3d.portrait.BackgroundMusicActivity"
-            android:screenOrientation="portrait"
+            android:screenOrientation="behind"^M
             android:theme="@style/Theme.AppCompat.NoActionBar" />
     </application>

2、代码里面也设置了屏幕竖屏的方法我几乎是有相关的都注释屏蔽掉了,不过我觉得把BaseActivity里面的注释掉就行了,如果不行那就把NewGallery2里面相关旋转的代码都注释掉,反正我是这么做的。 

+++ b/vendor/sprd/platform/packages/apps/NewGallery2/src/com/android/gallery3d/v2/app/BaseActivity.java
@@ -459,11 +459,12 @@ public abstract class BaseActivity extends AppCompatActivity implements IStorage
     private void onScreenRotationChanged() {
         int rotation = Settings.System.getInt(getContentResolver(), Settings.System.ACCELEROMETER_ROTATION, 0);
         Log.d(TAG, "onScreenRotationChanged rotation = " + rotation);
-        if (1 == rotation) {
-            setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
-        } else {
-            setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
-        }
+         Log.d("bll", "----xxxx---"+rotation);^M
+        // if (1 == rotation) {^M
+        //     setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);^M
+        // } else {^M
+        //     setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);^M
+        // }^M
     }
 
     public void lockScreen() {
@@ -477,11 +478,12 @@ public abstract class BaseActivity extends AppCompatActivity implements IStorage
     }
 
     private void registerScreenRotationObserver() {
-        if (1 == Settings.System.getInt(getContentResolver(), Settings.System.ACCELEROMETER_ROTATION, 0)) {
-            setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
-        } else {
-            setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
-        }
+         Log.d("bll", "----yyyy---");^M
+        // if (1 == Settings.System.getInt(getContentResolver(), Settings.System.ACCELEROMETER_ROTATION, 0)) {^M
+        //     setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);^M
+        // } else {^M
+        //     setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);^M
+        // }^M
         getContentResolver().registerContentObserver(Settings.System.getUriFor(Settings.System.ACCELEROMETER_ROTATIO
N), true, mScreenRotationObserver);
     }

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值