Skip to content

Commit

Permalink
Add custom permissions
Browse files Browse the repository at this point in the history
  • Loading branch information
DaVinci9196 committed Nov 18, 2024
1 parent 6eca16a commit e01ca2e
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 1 deletion.
5 changes: 5 additions & 0 deletions play-services-core/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,11 @@
android:permissionGroup="com.google.android.gms.permission.CAR_INFORMATION"
android:protectionLevel="dangerous" />

<permission
android:name="com.google.android.gms.auth.permission.GOOGLE_ACCOUNT_CHANGE"
android:protectionLevel="signature"/>
<uses-permission android:name="com.google.android.gms.auth.permission.GOOGLE_ACCOUNT_CHANGE" />

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ public class LoginActivity extends AssistantActivity {
private static final String MAGIC_USER_AGENT = " MinuteMaid";
private static final String COOKIE_OAUTH_TOKEN = "oauth_token";
private static final String ACTION_UPDATE_ACCOUNT = "com.google.android.gms.auth.GOOGLE_ACCOUNT_CHANGE";
private static final String PERMISSION_UPDATE_ACCOUNT = "com.google.android.gms.auth.permission.GOOGLE_ACCOUNT_CHANGE";

private final FidoHandler fidoHandler = new FidoHandler(this);
private final DroidGuardHandler dgHandler = new DroidGuardHandler(this);
Expand Down Expand Up @@ -363,7 +364,7 @@ private void returnSuccessResponse(Account account){
Intent intent = new Intent(ACTION_UPDATE_ACCOUNT);
intent.setPackage(VENDING_PACKAGE_NAME);
intent.putExtra(AccountManager.KEY_ACCOUNT_NAME, account.name);
sendBroadcast(intent);
sendBroadcast(intent, PERMISSION_UPDATE_ACCOUNT);
}
private void retrieveGmsToken(final Account account) {
final AuthManager authManager = new AuthManager(this, account.name, GMS_PACKAGE_NAME, "ac2dm");
Expand Down
2 changes: 2 additions & 0 deletions vending-app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="com.google.android.gms.permission.READ_SETTINGS" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="com.google.android.gms.auth.permission.GOOGLE_ACCOUNT_CHANGE"/>

<uses-permission
android:name="android.permission.USE_CREDENTIALS"
Expand Down Expand Up @@ -177,6 +178,7 @@

<receiver
android:name="com.google.android.finsky.accounts.impl.AccountsChangedReceiver"
android:permission="com.google.android.gms.auth.permission.GOOGLE_ACCOUNT_CHANGE"
android:exported="true">
<intent-filter>
<action android:name="com.google.android.gms.auth.GOOGLE_ACCOUNT_CHANGE"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ class AccountsChangedReceiver : BroadcastReceiver() {
Log.d(TAG, "onReceive: intent-> $intent")
var accountName: String? = null
if (intent?.let { accountName = it.getStringExtra(AccountManager.KEY_ACCOUNT_NAME) } == null) {
Log.d(TAG, "onReceive: accountName is empty")
return
}
GlobalScope.launch(Dispatchers.IO) {
Expand Down

0 comments on commit e01ca2e

Please sign in to comment.