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

Commit 06f429ed authored by Android (Google) Code Review's avatar Android (Google) Code Review
Browse files

Merge change 1470

* changes:
  Make android.content.ComponentName implement java.lang.Comparable.
parents 7391f42d 6b61d41f
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -24667,6 +24667,8 @@
 deprecated="not deprecated"
 visibility="public"
>
<implements name="java.lang.Comparable">
</implements>
<implements name="android.os.Parcelable">
</implements>
<constructor name="ComponentName"
@@ -24715,6 +24717,19 @@
<parameter name="in" type="android.os.Parcel">
</parameter>
</constructor>
<method name="compareTo"
 return="int"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
<parameter name="that" type="android.content.ComponentName">
</parameter>
</method>
<method name="describeContents"
 return="int"
 abstract="false"
+11 −1
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ package android.content;

import android.os.Parcel;
import android.os.Parcelable;
import java.lang.Comparable;

/**
 * Identifier for a specific application component
@@ -29,7 +30,7 @@ import android.os.Parcelable;
 * name inside of that package.
 * 
 */
public final class ComponentName implements Parcelable {
public final class ComponentName implements Parcelable, Comparable<ComponentName> {
    private final String mPackage;
    private final String mClass;

@@ -197,6 +198,15 @@ public final class ComponentName implements Parcelable {
        return mPackage.hashCode() + mClass.hashCode();
    }

    public int compareTo(ComponentName that) {
        int v;
        v = this.mPackage.compareTo(that.mPackage);
        if (v != 0) {
            return v;
        }
        return this.mClass.compareTo(that.mClass);
    }
    
    public int describeContents() {
        return 0;
    }