Merge change 1470
* changes: Make android.content.ComponentName implement java.lang.Comparable.
This commit is contained in:
@@ -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"
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -196,6 +197,15 @@ public final class ComponentName implements Parcelable {
|
||||
public int hashCode() {
|
||||
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;
|
||||
|
||||
Reference in New Issue
Block a user