Skip to content

Commit 29632c2

Browse files
committed
add Contact Scopes link to the "App info" screen
1 parent 0f372b3 commit 29632c2

File tree

4 files changed

+33
-0
lines changed

4 files changed

+33
-0
lines changed

res/values/strings_ext.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ No query or data is sent to the server. These files contain orbits and statuses
6565
<string name="psds_disabled">Disabled</string>
6666
<string name="psds_disabled_summary">Will make acquiring location lock significantly slower, especially if SUPL is disabled too</string>
6767

68+
<string name="contact_scopes">Contact Scopes</string>
69+
6870
<string name="conn_checks_grapheneos_server">GrapheneOS server</string>
6971
<string name="conn_checks_google_server">Standard (Google) server</string>
7072
<string name="conn_checks_disabled">Disabled</string>

res/xml/app_info_settings.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,12 @@
6464
android:title="@string/storage_scopes"
6565
settings:controller="com.android.settings.applications.appinfo.AppStorageScopesPreferenceController" />
6666

67+
<Preference
68+
android:key="contact_scopes"
69+
android:title="@string/contact_scopes"
70+
settings:controller="com.android.settings.applications.appinfo.AppContactScopesPreferenceController" />
71+
72+
6773
<Preference
6874
android:key="storage_settings"
6975
android:title="@string/storage_settings_for_app"
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package com.android.settings.applications.appinfo;
2+
3+
import android.content.Context;
4+
import android.content.pm.GosPackageState;
5+
import android.ext.cscopes.ContactScopesApi;
6+
7+
import com.android.settings.ext.AppInfoPreferenceControllerBase2;
8+
9+
public class AppContactScopesPreferenceController extends AppInfoPreferenceControllerBase2 {
10+
public AppContactScopesPreferenceController(Context context, String key) {
11+
super(context, key);
12+
}
13+
14+
@Override
15+
public int getAvailabilityStatus() {
16+
return hasGosPackageStateFlags(GosPackageState.FLAG_CONTACT_SCOPES_ENABLED) ?
17+
AVAILABLE : CONDITIONALLY_UNAVAILABLE;
18+
}
19+
20+
@Override
21+
public void onPreferenceClick(String packageName) {
22+
mContext.startActivity(ContactScopesApi.createConfigActivityIntent(packageName));
23+
}
24+
}

src/com/android/settings/applications/appinfo/AppInfoDashboardFragment.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,7 @@ public void onAttach(Context context) {
179179
use(AppStoragePreferenceController.class).setParentFragment(this);
180180
use(AppVersionPreferenceController.class).setParentFragment(this);
181181
use(AppStorageScopesPreferenceController.class).setParentFragment(this);
182+
use(AppContactScopesPreferenceController.class).setParentFragment(this);
182183
use(InstantAppDomainsPreferenceController.class).setParentFragment(this);
183184

184185
final HibernationSwitchPreferenceController appHibernationSettings =

0 commit comments

Comments
 (0)