Use start/finish app ops in window manager

Add infrastructure to app ops to specify how to treat mode_default
(for now only for startOp) allowing the caller to decide of this
mode should be treated as success - this is useful if the caller
already performed the default permission checks which determined
that the caller would perform the operation if the mode is default.
This way there is a record in the app ops history that this op
was performed. This is now used by the window manager service
which starts/finishes ops when an alert window is shown/hidden.
The window manager allows adding the window if the mode is default
but the caller has the fallback permission. In this case the
alert window would be shown and we want that noted in the op
history.

Now the window manager properly starts/finishes alert window op
when an alert window is shown/hidden. This is required to allow
SystemUI to badge notifications from apps showing alert windows
or add a dedicated notification if the app has no notifications.

Test: cts-tradefed run cts-dev -m CtsWindowManagerDeviceTestCases

      Added android.server.wm.AppOpAlertWindowAppOpsTest

      cts-tradefed run cts-dev -m CtsPermissionTestCases
          -t android.permission.cts.AppOpsTest

bug:64085448

Change-Id: I9041b1ac287bc5f9ed11d39bb203beba80f3f0f6
11 files changed