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

Commit e7127cb8 authored by Android Build Coastguard Worker's avatar Android Build Coastguard Worker
Browse files

Merge cherrypicks of ['googleplex-android-review.googlesource.com/26560268'] into 24Q2-release.

Change-Id: I8cf0126bdb406831d80f194e1d8e32928341ebcd
parents 9ca46c33 24f2aebd
Loading
Loading
Loading
Loading
+0 −8
Original line number Diff line number Diff line
@@ -77,7 +77,6 @@ aconfig_declarations_group {
        "camera_platform_flags_core_java_lib",
        "com.android.hardware.input-aconfig-java",
        "com.android.input.flags-aconfig-java",
        "com.android.internal.compat.flags-aconfig-java",
        "com.android.internal.foldables.flags-aconfig-java",
        "com.android.internal.pm.pkg.component.flags-aconfig-java",
        "com.android.media.flags.bettertogether-aconfig-java",
@@ -631,13 +630,6 @@ java_aconfig_library {
    defaults: ["framework-minus-apex-aconfig-java-defaults"],
}

// Platform Compat
java_aconfig_library {
    name: "com.android.internal.compat.flags-aconfig-java",
    aconfig_declarations: "compat_logging_flags",
    defaults: ["framework-minus-apex-aconfig-java-defaults"],
}

// Multi user
aconfig_declarations {
    name: "android.multiuser.flags-aconfig",
+1 −4
Original line number Diff line number Diff line
@@ -970,7 +970,6 @@ public final class ActivityThread extends ClientTransactionHandler
        ContentCaptureOptions contentCaptureOptions;

        long[] disabledCompatChanges;
        long[] mLoggableCompatChanges;

        SharedMemory mSerializedSystemFontMap;

@@ -1280,7 +1279,6 @@ public final class ActivityThread extends ClientTransactionHandler
                AutofillOptions autofillOptions,
                ContentCaptureOptions contentCaptureOptions,
                long[] disabledCompatChanges,
                long[] loggableCompatChanges,
                SharedMemory serializedSystemFontMap,
                long startRequestedElapsedTime,
                long startRequestedUptime) {
@@ -1335,7 +1333,6 @@ public final class ActivityThread extends ClientTransactionHandler
            data.autofillOptions = autofillOptions;
            data.contentCaptureOptions = contentCaptureOptions;
            data.disabledCompatChanges = disabledCompatChanges;
            data.mLoggableCompatChanges = loggableCompatChanges;
            data.mSerializedSystemFontMap = serializedSystemFontMap;
            data.startRequestedElapsedTime = startRequestedElapsedTime;
            data.startRequestedUptime = startRequestedUptime;
@@ -7106,7 +7103,7 @@ public final class ActivityThread extends ClientTransactionHandler
        Process.setStartTimes(SystemClock.elapsedRealtime(), SystemClock.uptimeMillis(),
                data.startRequestedElapsedTime, data.startRequestedUptime);

        AppCompatCallbacks.install(data.disabledCompatChanges, data.mLoggableCompatChanges);
        AppCompatCallbacks.install(data.disabledCompatChanges);
        // Let libcore handle any compat changes after installing the list of compat changes.
        AppSpecializationHooks.handleCompatChangesBeforeBindingApplication();

+13 −31
Original line number Diff line number Diff line
@@ -30,59 +30,41 @@ import java.util.Arrays;
 */
public final class AppCompatCallbacks implements Compatibility.BehaviorChangeDelegate {
    private final long[] mDisabledChanges;
    private final long[] mLoggableChanges;
    private final ChangeReporter mChangeReporter;

    /**
     * Install this class into the current process using the disabled and loggable changes lists.
     * Install this class into the current process.
     *
     * @param disabledChanges Set of compatibility changes that are disabled for this process.
     * @param loggableChanges Set of compatibility changes that we want to log.
     */
    public static void install(long[] disabledChanges, long[] loggableChanges) {
        Compatibility.setBehaviorChangeDelegate(
                new AppCompatCallbacks(disabledChanges, loggableChanges));
    public static void install(long[] disabledChanges) {
        Compatibility.setBehaviorChangeDelegate(new AppCompatCallbacks(disabledChanges));
    }

    private AppCompatCallbacks(long[] disabledChanges, long[] loggableChanges) {
    private AppCompatCallbacks(long[] disabledChanges) {
        mDisabledChanges = Arrays.copyOf(disabledChanges, disabledChanges.length);
        mLoggableChanges = Arrays.copyOf(loggableChanges, loggableChanges.length);
        Arrays.sort(mDisabledChanges);
        Arrays.sort(mLoggableChanges);
        mChangeReporter = new ChangeReporter(ChangeReporter.SOURCE_APP_PROCESS);
    }

    /**
     * Helper to determine if a list contains a changeId.
     *
     * @param list to search through
     * @param changeId for which to search in the list
     * @return true if the given changeId is found in the provided array.
     */
    private boolean changeIdInChangeList(long[] list, long changeId) {
        return Arrays.binarySearch(list, changeId) >= 0;
        mChangeReporter = new ChangeReporter(
                ChangeReporter.SOURCE_APP_PROCESS);
    }

    public void onChangeReported(long changeId) {
        boolean isLoggable = changeIdInChangeList(mLoggableChanges, changeId);
        reportChange(changeId, ChangeReporter.STATE_LOGGED, isLoggable);
        reportChange(changeId, ChangeReporter.STATE_LOGGED);
    }

    public boolean isChangeEnabled(long changeId) {
        boolean isEnabled = !changeIdInChangeList(mDisabledChanges, changeId);
        boolean isLoggable = changeIdInChangeList(mLoggableChanges, changeId);
        if (isEnabled) {
            // Not present in the disabled changeId array
            reportChange(changeId, ChangeReporter.STATE_ENABLED, isLoggable);
        if (Arrays.binarySearch(mDisabledChanges, changeId) < 0) {
            // Not present in the disabled array
            reportChange(changeId, ChangeReporter.STATE_ENABLED);
            return true;
        }
        reportChange(changeId, ChangeReporter.STATE_DISABLED, isLoggable);
        reportChange(changeId, ChangeReporter.STATE_DISABLED);
        return false;
    }

    private void reportChange(long changeId, int state, boolean isLoggable) {
    private void reportChange(long changeId, int state) {
        int uid = Process.myUid();
        mChangeReporter.reportChange(uid, changeId, state, isLoggable);
        mChangeReporter.reportChange(uid, changeId, state);
    }

}
+1 −1
Original line number Diff line number Diff line
@@ -90,7 +90,7 @@ oneway interface IApplicationThread {
            in CompatibilityInfo compatInfo, in Map services,
            in Bundle coreSettings, in String buildSerial, in AutofillOptions autofillOptions,
            in ContentCaptureOptions contentCaptureOptions, in long[] disabledCompatChanges,
            in long[] loggableCompatChanges, in SharedMemory serializedSystemFontMap,
            in SharedMemory serializedSystemFontMap,
            long startRequestedElapsedTime, long startRequestedUptime);
    void runIsolatedEntryPoint(in String entryPoint, in String[] entryPointArgs);
    void scheduleExit();
+0 −7
Original line number Diff line number Diff line
aconfig_declarations {
    name: "compat_logging_flags",
    package: "com.android.internal.compat.flags",
    srcs: [
        "compat_logging_flags.aconfig",
    ],
}
Loading