Add intent filter to launch usage access for app.
Change-Id: Ide8aa590f9b4218d0f4affe65a7daec384480798 Fixes: 110200770 Test: adb shell am start -a android.settings.USAGE_ACCESS_SETTINGS -d package:com.android.settings
This commit is contained in:
@@ -1382,6 +1382,21 @@
|
|||||||
android:value="com.android.settings.applications.manageapplications.ManageApplications" />
|
android:value="com.android.settings.applications.manageapplications.ManageApplications" />
|
||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
|
<activity
|
||||||
|
android:name="Settings$AppUsageAccessSettingsActivity"
|
||||||
|
android:label="@string/usage_access_title"
|
||||||
|
android:taskAffinity="com.android.settings"
|
||||||
|
android:parentActivityName="Settings">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.settings.USAGE_ACCESS_SETTINGS"/>
|
||||||
|
<category android:name="android.intent.category.DEFAULT"/>
|
||||||
|
<data android:scheme="package"/>
|
||||||
|
</intent-filter>
|
||||||
|
<meta-data
|
||||||
|
android:name="com.android.settings.FRAGMENT_CLASS"
|
||||||
|
android:value="com.android.settings.applications.UsageAccessDetails"/>
|
||||||
|
</activity>
|
||||||
|
|
||||||
<activity android:name="Settings$IccLockSettingsActivity"
|
<activity android:name="Settings$IccLockSettingsActivity"
|
||||||
android:label="@string/sim_lock_settings"
|
android:label="@string/sim_lock_settings"
|
||||||
android:process="com.android.phone">
|
android:process="com.android.phone">
|
||||||
|
@@ -68,6 +68,7 @@ public class Settings extends SettingsActivity {
|
|||||||
public static class AccessibilityDaltonizerSettingsActivity extends SettingsActivity { /* empty */ }
|
public static class AccessibilityDaltonizerSettingsActivity extends SettingsActivity { /* empty */ }
|
||||||
public static class SecurityDashboardActivity extends SettingsActivity { /* empty */ }
|
public static class SecurityDashboardActivity extends SettingsActivity { /* empty */ }
|
||||||
public static class UsageAccessSettingsActivity extends SettingsActivity { /* empty */ }
|
public static class UsageAccessSettingsActivity extends SettingsActivity { /* empty */ }
|
||||||
|
public static class AppUsageAccessSettingsActivity extends SettingsActivity { /* empty */ }
|
||||||
public static class LocationSettingsActivity extends SettingsActivity { /* empty */ }
|
public static class LocationSettingsActivity extends SettingsActivity { /* empty */ }
|
||||||
public static class ScanningSettingsActivity extends SettingsActivity { /* empty */ }
|
public static class ScanningSettingsActivity extends SettingsActivity { /* empty */ }
|
||||||
public static class PrivacySettingsActivity extends SettingsActivity { /* empty */ }
|
public static class PrivacySettingsActivity extends SettingsActivity { /* empty */ }
|
||||||
|
@@ -60,8 +60,7 @@ public abstract class AppInfoBase extends SettingsPreferenceFragment
|
|||||||
public static final String ARG_PACKAGE_NAME = "package";
|
public static final String ARG_PACKAGE_NAME = "package";
|
||||||
public static final String ARG_PACKAGE_UID = "uid";
|
public static final String ARG_PACKAGE_UID = "uid";
|
||||||
|
|
||||||
protected static final String TAG = AppInfoBase.class.getSimpleName();
|
private static final String TAG = "AppInfoBase";
|
||||||
protected static final boolean localLOGV = false;
|
|
||||||
|
|
||||||
protected EnforcedAdmin mAppsControlDisallowedAdmin;
|
protected EnforcedAdmin mAppsControlDisallowedAdmin;
|
||||||
protected boolean mAppsControlDisallowedBySystem;
|
protected boolean mAppsControlDisallowedBySystem;
|
||||||
@@ -113,7 +112,7 @@ public abstract class AppInfoBase extends SettingsPreferenceFragment
|
|||||||
getActivity(), UserManager.DISALLOW_APPS_CONTROL, mUserId);
|
getActivity(), UserManager.DISALLOW_APPS_CONTROL, mUserId);
|
||||||
|
|
||||||
if (!refreshUi()) {
|
if (!refreshUi()) {
|
||||||
setIntentAndFinish(true, true);
|
setIntentAndFinish(true /* appChanged */);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -159,8 +158,8 @@ public abstract class AppInfoBase extends SettingsPreferenceFragment
|
|||||||
return mPackageName;
|
return mPackageName;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void setIntentAndFinish(boolean finish, boolean appChanged) {
|
protected void setIntentAndFinish(boolean appChanged) {
|
||||||
if (localLOGV) Log.i(TAG, "appChanged=" + appChanged);
|
Log.i(TAG, "appChanged=" + appChanged);
|
||||||
Intent intent = new Intent();
|
Intent intent = new Intent();
|
||||||
intent.putExtra(ManageApplications.APP_CHG, appChanged);
|
intent.putExtra(ManageApplications.APP_CHG, appChanged);
|
||||||
SettingsActivity sa = (SettingsActivity) getActivity();
|
SettingsActivity sa = (SettingsActivity) getActivity();
|
||||||
@@ -216,7 +215,7 @@ public abstract class AppInfoBase extends SettingsPreferenceFragment
|
|||||||
@Override
|
@Override
|
||||||
public void onPackageListChanged() {
|
public void onPackageListChanged() {
|
||||||
if (!refreshUi()) {
|
if (!refreshUi()) {
|
||||||
setIntentAndFinish(true, true);
|
setIntentAndFinish(true /* appChanged */);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -30,6 +30,8 @@ import com.android.settingslib.applications.AppUtils;
|
|||||||
|
|
||||||
public abstract class AppInfoWithHeader extends AppInfoBase {
|
public abstract class AppInfoWithHeader extends AppInfoBase {
|
||||||
|
|
||||||
|
private static final String TAG = "AppInfoWithHeader";
|
||||||
|
|
||||||
private boolean mCreated;
|
private boolean mCreated;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@@ -510,7 +510,7 @@ public class AppStorageSettings extends AppInfoWithHeader
|
|||||||
public void onClick(DialogInterface dialog, int which) {
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
mButtonsPref.setButton1Enabled(false);
|
mButtonsPref.setButton1Enabled(false);
|
||||||
//force to recompute changed value
|
//force to recompute changed value
|
||||||
setIntentAndFinish(false, false);
|
setIntentAndFinish(false /* appChanged */);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.create();
|
.create();
|
||||||
|
Reference in New Issue
Block a user