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

Commit 507d3a5b authored by Tyler Gunn's avatar Tyler Gunn Committed by android-build-merger
Browse files

Merge "Add PhoneAccountHandle method to check if 2 accts are from same CS." into qt-dev

am: b1145bd8

Change-Id: Iaf26c428482c81592d07e046aa0b26703c0937a8
parents c1596ec2 b1145bd8
Loading
Loading
Loading
Loading
+18 −0
Original line number Original line Diff line number Diff line
@@ -17,6 +17,7 @@
package android.telecom;
package android.telecom;


import android.annotation.NonNull;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.UnsupportedAppUsage;
import android.annotation.UnsupportedAppUsage;
import android.content.ComponentName;
import android.content.ComponentName;
import android.os.Build;
import android.os.Build;
@@ -174,4 +175,21 @@ public final class PhoneAccountHandle implements Parcelable {
                in.readString(),
                in.readString(),
                UserHandle.CREATOR.createFromParcel(in));
                UserHandle.CREATOR.createFromParcel(in));
    }
    }

    /**
     * Determines if two {@link PhoneAccountHandle}s are from the same package.
     *
     * @param a Phone account handle to check for same {@link ConnectionService} package.
     * @param b Other phone account handle to check for same {@link ConnectionService} package.
     * @return {@code true} if the two {@link PhoneAccountHandle}s passed in belong to the same
     * {@link ConnectionService} / package, {@code false} otherwise.  Note: {@code null} phone
     * account handles are considered equivalent to other {@code null} phone account handles.
     * @hide
     */
    public static boolean areFromSamePackage(@Nullable PhoneAccountHandle a,
            @Nullable PhoneAccountHandle b) {
        String aPackageName = a != null ? a.getComponentName().getPackageName() : null;
        String bPackageName = b != null ? b.getComponentName().getPackageName() : null;
        return Objects.equals(aPackageName, bPackageName);
    }
}
}