Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a4710f3d authored by Yohei Yukawa's avatar Yohei Yukawa
Browse files

Remove a redundant Binder.clearCallingIdentity()

Following method/fields access should never require system server
priviledge.  Hence there is no need to clear calling identity.

  * ApplicationInfo#flags
  * InputMethodInfo.getServiceInfo()
  * ServiceInfo#applicationInfo
  * ServiceInfo#packageName

This CL should be no user-observable behavior change.

Bug: 120709962
Test: Manually verified as follows.
  1. Build aosp_taimen-userdebug and flash it
  2. Install TestDPC.
  3. Set up a work profile
  4. Open TestDPC in the work profile mode.
  5. Tap "Set input methods"
  6. Tap "OK"
  7. Open Settings App -> System -> Languages & input -> Virtual keyboard
  8. Tap "Manage keyboards"
  9. Make sure nothing crashes.
 10. make -j SoftKeyboard
 11. adb install -r $OUT/system/app/SoftKeyboard/SoftKeyboard.apk
 12. Open TestDPC in the work profile mode.
 13. Tap "Set input methods"
 14. Make sure that "Sample Soft Keyboard" is unchecked.
 15. Tap "OK".
 16. Open Settings App -> System -> Languages & input -> Virtual keyboard
 17. Tap "Manage keyboards"
 18. Make sure that you cannot enable "Sample Soft Keyboard"
Change-Id: Idce0ac68ee6a6ca6e1186bd2adf9bd07a1f9f397
parent 2232e861
Loading
Loading
Loading
Loading
+6 −11
Original line number Diff line number Diff line
@@ -9293,8 +9293,6 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
                InputMethodManager inputMethodManager =
                        mContext.getSystemService(InputMethodManager.class);
                List<InputMethodInfo> imes = inputMethodManager.getInputMethodList();
                long id = mInjector.binderClearCallingIdentity();
                try {
                if (imes != null) {
                    for (InputMethodInfo ime : imes) {
                        ServiceInfo serviceInfo = ime.getServiceInfo();
@@ -9304,9 +9302,6 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
                        }
                    }
                }
                } finally {
                    mInjector.binderRestoreCallingIdentity(id);
                }
            }
            return result;
        }