更改系统导航后会看到摄像头错误(Camera error is seen after changing system navigation.)

Issue:
"
Reproduction Steps:

  1. Flash a new PRD daily build on Jaws or Nazare.
  2. Open camera app, then press Home button to exit.
  3. Navigate to settings->system->Gestures->System navigation.
  4. Switch system navigation between "3-button navigation" and "Gesture navigation" for several times.
  5. Open camera app again from recent apps and observe.

"

Solution:


Solution: When user change system navigation, SystemNavigationGestureSettings kill the com.symbol.zcam if it running background.


packages/apps/Settings/src/com/android/settings/gestures/SystemNavigationGestureSettings.java

 

diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 62314ed..6484bf0 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -1,4 +1,4 @@
-<!-- Copyright (c) 2021 XXX Technologies Corporation and/or its affiliates. All rights reserved.
+<!-- Copyright (c) 2021-2022 XXX Technologies Corporation and/or its affiliates. All rights reserved.
      Licensed under the Apache License, Version 2.0 (the "License");
      you may not use this file except in compliance with the License.
      You may obtain a copy of the License at
@@ -19,6 +19,7 @@
 
     <original-package android:name="com.android.settings" />
 
+    <uses-permission android:name="android.permission.KILL_BACKGROUND_PROCESSES"/>
     <uses-permission android:name="android.permission.REQUEST_NETWORK_SCORES" />
     <uses-permission android:name="android.permission.WRITE_MEDIA_STORAGE" />
     <uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" />
diff --git a/src/com/android/settings/gestures/SystemNavigationGestureSettings.java b/src/com/android/settings/gestures/SystemNavigationGestureSettings.java
index bed14a8..971dc05 100644
--- a/src/com/android/settings/gestures/SystemNavigationGestureSettings.java
+++ b/src/com/android/settings/gestures/SystemNavigationGestureSettings.java
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 2018 The Android Open Source Project
- *
+ * Copyright (c) 2022 XXX Technologies Corporation and/or its affiliates. All rights reserved
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
@@ -24,6 +24,8 @@
 import static com.android.settings.widget.RadioButtonPreferenceWithExtraWidget.EXTRA_WIDGET_VISIBILITY_GONE;
 import static com.android.settings.widget.RadioButtonPreferenceWithExtraWidget.EXTRA_WIDGET_VISIBILITY_SETTING;
 
+import android.os.SystemProperties;
+import android.app.ActivityManager;
 import android.app.settings.SettingsEnums;
 import android.content.Context;
 import android.content.Intent;
@@ -55,6 +57,8 @@
 import com.android.settingslib.widget.CandidateInfo;
 import com.android.settingslib.widget.RadioButtonPreference;
 
+import com.xxx.util.XXXUtils;
+
 import java.util.ArrayList;
 import java.util.List;
 
@@ -106,6 +110,23 @@
         return SettingsEnums.SETTINGS_GESTURE_SWIPE_UP;
     }
 
+    //BSPA-198543 Kill the com.symbol.zcam if it running background.
+    @Override
+    public void onResume() {
+        super.onResume();
+        final Context context = getContext();
+        if ((XXXUtils.isXXX().orElse(false) &&
+                SystemProperties.getInt("ro.product.first_api_level", -1) == 30)) {
+            ActivityManager activityManager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
+            for (ActivityManager.RunningAppProcessInfo info : activityManager.getRunningAppProcesses()) {
+                if (info.processName.equals("com.symbol.zcam")) {
+                   activityManager.killBackgroundProcesses("com.symbol.zcam");
+                   break;
+                }
+            }
+        }
+    }
+
     @Override
     public void updateCandidates() {
         final String defaultKey = getDefaultKey();

  • 4
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值