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

Commit ad26f036 authored by Mariia Sandrikova's avatar Mariia Sandrikova
Browse files

[3/n] Camera Compat: Refresh activity

Introduce RefreshCallbackItem that allows to "refresh" activity by going through "stopped -> resumed" or "paused -> resumed" cycle. This allows to clear cached values in apps (e.g. display or camera rotation) that influence camera preview and can lead to sideways or stretching issues persisting even after force rotation in DisplayRotationCompatPolicy.

Using "stop -> resumed" cycle by default due to higher success rate confirmed with app compatibility testing. But introduce ADB commands that allow trying both.

Bug: 218352945
Test: atest WmTests:DisplayRotationCompatPolicyTests
Change-Id: Iaca54b197937147f93d52297543b106fd5b97322
parent da4c5523
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -58,6 +58,15 @@ public class ActivityClient {
        }
    }

    /** Reports {@link android.app.servertransaction.RefreshCallbackItem} is executed. */
    public void activityRefreshed(IBinder token) {
        try {
            getActivityClientController().activityRefreshed(token);
        } catch (RemoteException e) {
            e.rethrowFromSystemServer();
        }
    }

    /**
     * Reports after {@link Activity#onTopResumedActivityChanged(boolean)} is called for losing the
     * top most position.
+5 −0
Original line number Diff line number Diff line
@@ -5249,6 +5249,11 @@ public final class ActivityThread extends ClientTransactionHandler
        }
    }

    @Override
    public void reportRefresh(ActivityClientRecord r) {
        ActivityClient.getInstance().activityRefreshed(r.token);
    }

    private void handleSetCoreSettings(Bundle coreSettings) {
        synchronized (mCoreSettingsLock) {
            mCoreSettings = coreSettings;
+3 −0
Original line number Diff line number Diff line
@@ -140,6 +140,9 @@ public abstract class ClientTransactionHandler {
    /** Restart the activity after it was stopped. */
    public abstract void performRestartActivity(@NonNull ActivityClientRecord r, boolean start);

     /** Report that activity was refreshed to server. */
    public abstract void reportRefresh(@NonNull ActivityClientRecord r);

    /** Set pending activity configuration in case it will be updated by other transaction item. */
    public abstract void updatePendingActivityConfiguration(@NonNull IBinder token,
            Configuration overrideConfig);
+1 −0
Original line number Diff line number Diff line
@@ -38,6 +38,7 @@ import com.android.internal.policy.IKeyguardDismissCallback;
interface IActivityClientController {
    oneway void activityIdle(in IBinder token, in Configuration config, in boolean stopProfiling);
    oneway void activityResumed(in IBinder token, in boolean handleSplashScreenExit);
    oneway void activityRefreshed(in IBinder token);
    /**
     * This call is not one-way because {@link #activityPaused()) is not one-way, or
     * the top-resumed-lost could be reported after activity paused.
+3 −0
Original line number Diff line number Diff line
@@ -38,6 +38,9 @@ public abstract class ClientTransactionItem implements BaseClientRequest, Parcel
        return UNDEFINED;
    }

    boolean shouldHaveDefinedPreExecutionState() {
        return true;
    }

    // Parcelable

Loading