Refactor all lock task related methods into a new class

This simplifies the way lock task mode is called by creating a class
that is fully responsible for managing locked tasks. This enables unit
testing and makes it easier to see where individual calls are coming
from. Feeling is that there are some subtle bugs around synchronization
and expectations on the locked task APIs.

Also added unit tests for the new manager class.

Test: bit
FrameworksServicesTests:com.android.server.am.LockTaskManagerTest
Test: go/wm-smoke
Test: cts-tradefed run cts -m DevicePolicyManager --test
com.android.cts.devicepolicy.DeviceOwnerTest#testLockTask_deviceOwnerUser
Bug: 63909481
Change-Id: I3fa8606778fea5a801c21aebeb231db5a6bee47f
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarFragment.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarFragment.java
index c44e1db..cfe0a4a 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarFragment.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarFragment.java
@@ -504,7 +504,7 @@
                 // If we recently long-pressed the other button then they were
                 // long-pressed 'together'
                 if ((time - mLastLockToAppLongPress) < LOCK_TO_APP_GESTURE_TOLERENCE) {
-                    activityManager.stopLockTaskMode();
+                    activityManager.stopSystemLockTaskMode();
                     // When exiting refresh disabled flags.
                     mNavigationBarView.setDisabledFlags(mDisabledFlags1, true);
                     return true;
@@ -522,7 +522,7 @@
                 } else if (touchExplorationEnabled && inLockTaskMode) {
                     // When in accessibility mode a long press that is recents (not back)
                     // should stop lock task.
-                    activityManager.stopLockTaskMode();
+                    activityManager.stopSystemLockTaskMode();
                     // When exiting refresh disabled flags.
                     mNavigationBarView.setDisabledFlags(mDisabledFlags1, true);
                     return true;