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

Commit 39c90ea9 authored by android-build-team Robot's avatar android-build-team Robot
Browse files

Snap for 6964419 from 59b852c4 to rvc-qpr2-release

Change-Id: I45cfd762fa1bf29c9dbeeacd7bcd375d1811674b
parents 136e0300 59b852c4
Loading
Loading
Loading
Loading
+22 −7
Original line number Diff line number Diff line
@@ -46,6 +46,7 @@ public final class AssociationRequest implements Parcelable {

    private final boolean mSingleDevice;
    private final List<DeviceFilter<?>> mDeviceFilters;
    private String mCallingPackage;

    private AssociationRequest(
            boolean singleDevice, @Nullable List<DeviceFilter<?>> deviceFilters) {
@@ -57,6 +58,7 @@ public final class AssociationRequest implements Parcelable {
        this(
            in.readByte() != 0,
            in.readParcelableList(new ArrayList<>(), AssociationRequest.class.getClassLoader()));
        setCallingPackage(in.readString());
    }

    /** @hide */
@@ -72,32 +74,45 @@ public final class AssociationRequest implements Parcelable {
        return mDeviceFilters;
    }

    /** @hide */
    public String getCallingPackage() {
        return mCallingPackage;
    }

    /** @hide */
    public void setCallingPackage(String pkg) {
        mCallingPackage = pkg;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        AssociationRequest that = (AssociationRequest) o;
        return mSingleDevice == that.mSingleDevice &&
                Objects.equals(mDeviceFilters, that.mDeviceFilters);
        return mSingleDevice == that.mSingleDevice
                && Objects.equals(mDeviceFilters, that.mDeviceFilters)
                && Objects.equals(mCallingPackage, that.mCallingPackage);
    }

    @Override
    public int hashCode() {
        return Objects.hash(mSingleDevice, mDeviceFilters);
        return Objects.hash(mSingleDevice, mDeviceFilters, mCallingPackage);
    }

    @Override
    public String toString() {
        return "AssociationRequest{" +
                "mSingleDevice=" + mSingleDevice +
                ", mDeviceFilters=" + mDeviceFilters +
                '}';
        return "AssociationRequest{"
                + "mSingleDevice=" + mSingleDevice
                + ", mDeviceFilters=" + mDeviceFilters
                + ", mCallingPackage=" + mCallingPackage
                + '}';
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeByte((byte) (mSingleDevice ? 1 : 0));
        dest.writeParcelableList(mDeviceFilters, flags);
        dest.writeString(mCallingPackage);
    }

    @Override
+7 −0
Original line number Diff line number Diff line
@@ -18,6 +18,8 @@ package com.android.companiondevicemanager;

import static android.companion.BluetoothDeviceFilterUtils.getDeviceMacAddress;

import static java.util.Objects.requireNonNull;

import android.app.Activity;
import android.companion.CompanionDeviceManager;
import android.content.Intent;
@@ -116,6 +118,11 @@ public class DeviceChooserActivity extends Activity {
        }
    }

    @Override
    public String getCallingPackage() {
        return requireNonNull(getService().mRequest.getCallingPackage());
    }

    @Override
    public void setTitle(CharSequence title) {
        final TextView titleView = findViewById(R.id.title);
+2 −1
Original line number Diff line number Diff line
@@ -300,6 +300,7 @@ public class CompanionDeviceManagerService extends SystemService implements Bind
            mFindDeviceCallback = callback;
            mRequest = request;
            mCallingPackage = callingPackage;
            request.setCallingPackage(callingPackage);
            callback.asBinder().linkToDeath(CompanionDeviceManagerService.this /* recipient */, 0);

            final long callingIdentity = Binder.clearCallingIdentity();
@@ -308,7 +309,7 @@ public class CompanionDeviceManagerService extends SystemService implements Bind
                    AndroidFuture<Association> future = new AndroidFuture<>();
                    service.startDiscovery(request, callingPackage, callback, future);
                    return future;
                }).whenComplete(uncheckExceptions((association, err) -> {
                }).cancelTimeout().whenComplete(uncheckExceptions((association, err) -> {
                    if (err == null) {
                        addAssociation(association);
                    } else {
+7 −0
Original line number Diff line number Diff line
@@ -791,7 +791,10 @@ public final class BroadcastQueue {
                mService.updateOomAdjLocked(r.curApp, true,
                        OomAdjuster.OOM_ADJ_REASON_START_RECEIVER);
            }
        } else if (filter.receiverList.app != null) {
            mService.mOomAdjuster.mCachedAppOptimizer.unfreezeTemporarily(filter.receiverList.app);
        }

        try {
            if (DEBUG_BROADCAST_LIGHT) Slog.i(TAG_BROADCAST,
                    "Delivering to " + filter + " : " + r);
@@ -1121,6 +1124,10 @@ public final class BroadcastQueue {
                        }
                    }
                    if (sendResult) {
                        if (r.callerApp != null) {
                            mService.mOomAdjuster.mCachedAppOptimizer.unfreezeTemporarily(
                                    r.callerApp);
                        }
                        try {
                            if (DEBUG_BROADCAST) {
                                Slog.i(TAG_BROADCAST, "Finishing broadcast [" + mQueueName + "] "
+10 −0
Original line number Diff line number Diff line
@@ -720,6 +720,16 @@ public final class CachedAppOptimizer {
        }
    }

    // This will ensure app will be out of the freezer for at least FREEZE_TIMEOUT_MS
    void unfreezeTemporarily(ProcessRecord app) {
        synchronized (mAm) {
            if (app.frozen) {
                unfreezeAppLocked(app);
                freezeAppAsync(app);
            }
        }
    }

    @GuardedBy("mAm")
    void freezeAppAsync(ProcessRecord app) {
        mFreezeHandler.removeMessages(SET_FROZEN_PROCESS_MSG, app);
Loading