Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
gosps: share common code between GosPackageState and GosPackageStatePm
- Loading branch information
1 parent
623ac1f
commit ada89ee
Showing
4 changed files
with
65 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package android.content.pm; | ||
|
||
import android.annotation.Nullable; | ||
|
||
import java.util.Arrays; | ||
|
||
/** | ||
* Common code between GosPackageState and GosPackageStatePm. | ||
* | ||
* @hide | ||
*/ | ||
public abstract class GosPackageStateBase { | ||
public final int flags; | ||
@Nullable | ||
public final byte[] storageScopes; | ||
|
||
protected GosPackageStateBase(int flags, @Nullable byte[] storageScopes) { | ||
this.flags = flags; | ||
this.storageScopes = storageScopes; | ||
} | ||
|
||
public final boolean hasFlags(int flags) { | ||
return (this.flags & flags) == flags; | ||
} | ||
|
||
@Override | ||
public final int hashCode() { | ||
return 31 * flags + Arrays.hashCode(storageScopes); | ||
} | ||
|
||
@Override | ||
public final boolean equals(Object obj) { | ||
if (!(obj instanceof GosPackageStateBase)) { | ||
return false; | ||
} | ||
|
||
GosPackageStateBase o = (GosPackageStateBase) obj; | ||
if (flags != o.flags) { | ||
return false; | ||
} | ||
|
||
if (!Arrays.equals(storageScopes, o.storageScopes)) { | ||
return false; | ||
} | ||
|
||
return true; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters