Lauch manage permissions UI from settings

Change-Id: I96f75ebfb4c3984b7e93abf1de41963aa67d4cbd
This commit is contained in:
Svet Ganov
2015-03-24 16:31:57 -07:00
committed by Svetoslav
parent 2a837190a9
commit 79021c27c9

View File

@@ -20,6 +20,7 @@ import android.app.Activity;
import android.app.ActivityManager; import android.app.ActivityManager;
import android.app.AlertDialog; import android.app.AlertDialog;
import android.app.LoaderManager.LoaderCallbacks; import android.app.LoaderManager.LoaderCallbacks;
import android.content.ActivityNotFoundException;
import android.content.BroadcastReceiver; import android.content.BroadcastReceiver;
import android.content.ComponentName; import android.content.ComponentName;
import android.content.Context; import android.content.Context;
@@ -46,6 +47,7 @@ import android.preference.Preference.OnPreferenceClickListener;
import android.provider.Settings; import android.provider.Settings;
import android.text.format.DateUtils; import android.text.format.DateUtils;
import android.text.format.Formatter; import android.text.format.Formatter;
import android.util.Log;
import android.view.Menu; import android.view.Menu;
import android.view.MenuInflater; import android.view.MenuInflater;
import android.view.MenuItem; import android.view.MenuItem;
@@ -82,6 +84,8 @@ import java.util.List;
public class InstalledAppDetails extends AppInfoBase public class InstalledAppDetails extends AppInfoBase
implements View.OnClickListener, OnPreferenceClickListener { implements View.OnClickListener, OnPreferenceClickListener {
private static final String LOG_TAG = "InstalledAppDetails";
// Menu identifiers // Menu identifiers
public static final int UNINSTALL_ALL_USERS_MENU = 1; public static final int UNINSTALL_ALL_USERS_MENU = 1;
public static final int UNINSTALL_UPDATES = 2; public static final int UNINSTALL_UPDATES = 2;
@@ -563,6 +567,17 @@ public class InstalledAppDetails extends AppInfoBase
} }
} }
private void startManagePermissionsActivity() {
// start new activity to manage app permissions
Intent intent = new Intent(Intent.ACTION_MANAGE_APP_PERMISSIONS);
intent.putExtra(Intent.EXTRA_PACKAGE_NAME, mAppEntry.info.packageName);
try {
startActivity(intent);
} catch (ActivityNotFoundException e) {
Log.w(LOG_TAG, "No app can handle android.intent.action.MANAGE_APP_PERMISSIONS");
}
}
private void startAppInfoFragment(Class<? extends AppInfoBase> fragment, CharSequence title) { private void startAppInfoFragment(Class<? extends AppInfoBase> fragment, CharSequence title) {
// start new fragment to display extended information // start new fragment to display extended information
Bundle args = new Bundle(); Bundle args = new Bundle();
@@ -617,7 +632,7 @@ public class InstalledAppDetails extends AppInfoBase
} else if (preference == mNotificationPreference) { } else if (preference == mNotificationPreference) {
startNotifications(); startNotifications();
} else if (preference == mPermissionsPreference) { } else if (preference == mPermissionsPreference) {
startAppInfoFragment(AppPermissionSettings.class, mPermissionsPreference.getTitle()); startManagePermissionsActivity();
} else if (preference == mLaunchPreference) { } else if (preference == mLaunchPreference) {
startAppInfoFragment(AppLaunchSettings.class, mLaunchPreference.getTitle()); startAppInfoFragment(AppLaunchSettings.class, mLaunchPreference.getTitle());
} else if (preference == mDataPreference) { } else if (preference == mDataPreference) {