Fix several bugs in AppOp code that were introduced by device aware AppOp

These bugs are identified by reading the code or new CTS test.

Bug: 325776049
Test: atest AppOpsDeviceAwareTest
Change-Id: Ic251fb98c3ba46bc1b1f04da2d2301706f7c2607
5 files changed