Skip to content

Commit

Permalink
add Contact Scopes link to the "App info" screen
Browse files Browse the repository at this point in the history
  • Loading branch information
muhomorr authored and thestinger committed May 16, 2023
1 parent c8f7f47 commit ce91e17
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 0 deletions.
2 changes: 2 additions & 0 deletions res/values/strings_ext.xml
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,6 @@ No query or data is sent to the server. These files contain orbits and statuses
<string name="psds_disabled">Disabled</string>
<string name="psds_disabled_summary">Will make acquiring location lock significantly slower, especially if SUPL is disabled too</string>

<string name="contact_scopes">Contact Scopes</string>

</resources>
6 changes: 6 additions & 0 deletions res/xml/app_info_settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,12 @@
android:title="@string/storage_scopes"
settings:controller="com.android.settings.applications.appinfo.AppStorageScopesPreferenceController" />

<Preference
android:key="contact_scopes"
android:title="@string/contact_scopes"
settings:controller="com.android.settings.applications.appinfo.AppContactScopesPreferenceController" />


<Preference
android:key="storage_settings"
android:title="@string/storage_settings_for_app"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package com.android.settings.applications.appinfo;

import android.content.Context;
import android.content.pm.GosPackageState;
import android.ext.cscopes.ContactScopesApi;

import com.android.settings.ext.AppInfoPreferenceControllerBase2;

public class AppContactScopesPreferenceController extends AppInfoPreferenceControllerBase2 {
public AppContactScopesPreferenceController(Context context, String key) {
super(context, key);
}

@Override
public int getAvailabilityStatus() {
return hasGosPackageStateFlags(GosPackageState.FLAG_CONTACT_SCOPES_ENABLED) ?
AVAILABLE : CONDITIONALLY_UNAVAILABLE;
}

@Override
public void onPreferenceClick(String packageName) {
mContext.startActivity(ContactScopesApi.createConfigActivityIntent(packageName));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ public void onAttach(Context context) {
use(AppStoragePreferenceController.class).setParentFragment(this);
use(AppVersionPreferenceController.class).setParentFragment(this);
use(AppStorageScopesPreferenceController.class).setParentFragment(this);
use(AppContactScopesPreferenceController.class).setParentFragment(this);
use(InstantAppDomainsPreferenceController.class).setParentFragment(this);

final HibernationSwitchPreferenceController appHibernationSettings =
Expand Down

0 comments on commit ce91e17

Please sign in to comment.