Merge "Share apply token between WMCore and WMShell"
This commit is contained in:
@@ -105,4 +105,7 @@ interface IWindowOrganizerController {
|
||||
|
||||
/** @return An interface enabling the transition players to report its metrics. */
|
||||
ITransitionMetricsReporter getTransitionMetricsReporter();
|
||||
|
||||
/** @return The transaction queue token used by WM. */
|
||||
IBinder getApplyToken();
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@ import android.os.IBinder;
|
||||
import android.os.RemoteException;
|
||||
import android.util.Singleton;
|
||||
import android.view.RemoteAnimationAdapter;
|
||||
import android.view.SurfaceControl;
|
||||
|
||||
/**
|
||||
* Base class for organizing specific types of windows like Tasks and DisplayAreas
|
||||
@@ -184,6 +185,26 @@ public class WindowOrganizer {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Use WM's transaction-queue instead of Shell's independent one. This is necessary
|
||||
* if WM and Shell need to coordinate transactions (eg. for shell transitions).
|
||||
* @return true if successful, false otherwise.
|
||||
* @hide
|
||||
*/
|
||||
public boolean shareTransactionQueue() {
|
||||
final IBinder wmApplyToken;
|
||||
try {
|
||||
wmApplyToken = getWindowOrganizerController().getApplyToken();
|
||||
} catch (RemoteException e) {
|
||||
throw e.rethrowFromSystemServer();
|
||||
}
|
||||
if (wmApplyToken == null) {
|
||||
return false;
|
||||
}
|
||||
SurfaceControl.Transaction.setDefaultApplyToken(wmApplyToken);
|
||||
return true;
|
||||
}
|
||||
|
||||
static IWindowOrganizerController getWindowOrganizerController() {
|
||||
return IWindowOrganizerControllerSingleton.get();
|
||||
}
|
||||
|
||||
@@ -175,6 +175,9 @@ public class Transitions implements RemoteCallable<Transitions> {
|
||||
}
|
||||
|
||||
private void onInit() {
|
||||
if (Transitions.ENABLE_SHELL_TRANSITIONS) {
|
||||
mOrganizer.shareTransactionQueue();
|
||||
}
|
||||
mShellController.addExternalInterface(KEY_EXTRA_SHELL_SHELL_TRANSITIONS,
|
||||
this::createExternalInterface, this);
|
||||
|
||||
|
||||
@@ -1547,6 +1547,12 @@ class WindowOrganizerController extends IWindowOrganizerController.Stub
|
||||
return mTransitionController.mTransitionMetricsReporter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBinder getApplyToken() {
|
||||
enforceTaskPermission("getApplyToken()");
|
||||
return SurfaceControl.Transaction.getDefaultApplyToken();
|
||||
}
|
||||
|
||||
/** Whether the configuration changes are important to report back to an organizer. */
|
||||
static boolean configurationsAreEqualForOrganizer(
|
||||
Configuration newConfig, @Nullable Configuration oldConfig) {
|
||||
|
||||
Reference in New Issue
Block a user