Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
platform_frameworks_base-old
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Farzin Kazemzadeh
platform_frameworks_base-old
Commits
6af1516b
Commit
6af1516b
authored
6 years ago
by
Tyler Gunn
Committed by
Gerrit Code Review
6 years ago
Browse files
Options
Downloads
Plain Diff
Merge "Add equality method for PhoneAccount."
parents
80f3ddca
3b34781f
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
telecomm/java/android/telecom/PhoneAccount.java
+55
-0
55 additions, 0 deletions
telecomm/java/android/telecom/PhoneAccount.java
with
55 additions
and
0 deletions
telecomm/java/android/telecom/PhoneAccount.java
+
55
−
0
View file @
6af1516b
...
...
@@ -28,6 +28,7 @@ import java.lang.String;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.List
;
import
java.util.Objects
;
/**
* Represents a distinct method to place or receive a phone call. Apps which can place calls and
...
...
@@ -360,6 +361,33 @@ public final class PhoneAccount implements Parcelable {
private
boolean
mIsEnabled
;
private
String
mGroupId
;
@Override
public
boolean
equals
(
Object
o
)
{
if
(
this
==
o
)
return
true
;
if
(
o
==
null
||
getClass
()
!=
o
.
getClass
())
return
false
;
PhoneAccount
that
=
(
PhoneAccount
)
o
;
return
mCapabilities
==
that
.
mCapabilities
&&
mHighlightColor
==
that
.
mHighlightColor
&&
mSupportedAudioRoutes
==
that
.
mSupportedAudioRoutes
&&
mIsEnabled
==
that
.
mIsEnabled
&&
Objects
.
equals
(
mAccountHandle
,
that
.
mAccountHandle
)
&&
Objects
.
equals
(
mAddress
,
that
.
mAddress
)
&&
Objects
.
equals
(
mSubscriptionAddress
,
that
.
mSubscriptionAddress
)
&&
Objects
.
equals
(
mLabel
,
that
.
mLabel
)
&&
Objects
.
equals
(
mShortDescription
,
that
.
mShortDescription
)
&&
Objects
.
equals
(
mSupportedUriSchemes
,
that
.
mSupportedUriSchemes
)
&&
areBundlesEqual
(
mExtras
,
that
.
mExtras
)
&&
Objects
.
equals
(
mGroupId
,
that
.
mGroupId
);
}
@Override
public
int
hashCode
()
{
return
Objects
.
hash
(
mAccountHandle
,
mAddress
,
mSubscriptionAddress
,
mCapabilities
,
mHighlightColor
,
mLabel
,
mShortDescription
,
mSupportedUriSchemes
,
mSupportedAudioRoutes
,
mExtras
,
mIsEnabled
,
mGroupId
);
}
/**
* Helper class for creating a {@link PhoneAccount}.
*/
...
...
@@ -1022,4 +1050,31 @@ public final class PhoneAccount implements Parcelable {
return
sb
.
toString
();
}
/**
* Determines if two {@link Bundle}s are equal.
* @param extras First {@link Bundle} to check.
* @param newExtras {@link Bundle} to compare against.
* @return {@code true} if the {@link Bundle}s are equal, {@code false} otherwise.
*/
private
static
boolean
areBundlesEqual
(
Bundle
extras
,
Bundle
newExtras
)
{
if
(
extras
==
null
||
newExtras
==
null
)
{
return
extras
==
newExtras
;
}
if
(
extras
.
size
()
!=
newExtras
.
size
())
{
return
false
;
}
for
(
String
key
:
extras
.
keySet
())
{
if
(
key
!=
null
)
{
final
Object
value
=
extras
.
get
(
key
);
final
Object
newValue
=
newExtras
.
get
(
key
);
if
(!
Objects
.
equals
(
value
,
newValue
))
{
return
false
;
}
}
}
return
true
;
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment