App ops: new labels, fix crash, fix updating list.
- Add new labels for media ops. - Fix crash due to missing boolean entry for access notifications op. - Fix updating op category lists to remain stable (not jump back to the top). Change-Id: I505cfd91b1ff92587a627d33f3ac7a21145a9bbd
This commit is contained in:
@@ -589,6 +589,9 @@
|
|||||||
<item>modify settings</item>
|
<item>modify settings</item>
|
||||||
<item>draw on top</item>
|
<item>draw on top</item>
|
||||||
<item>access notifications</item>
|
<item>access notifications</item>
|
||||||
|
<item>camera</item>
|
||||||
|
<item>record audio</item>
|
||||||
|
<item>play audio</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
|
|
||||||
<!-- User display names for app ops codes -->
|
<!-- User display names for app ops codes -->
|
||||||
@@ -619,6 +622,9 @@
|
|||||||
<item>Modify settings</item>
|
<item>Modify settings</item>
|
||||||
<item>Draw on top</item>
|
<item>Draw on top</item>
|
||||||
<item>Access notifications</item>
|
<item>Access notifications</item>
|
||||||
|
<item>Camera</item>
|
||||||
|
<item>Record audio</item>
|
||||||
|
<item>Play audio</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
|
|
||||||
<!-- Titles for the list of long press timeout options. -->
|
<!-- Titles for the list of long press timeout options. -->
|
||||||
|
@@ -32,7 +32,7 @@ import android.preference.PreferenceActivity;
|
|||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.ArrayAdapter;
|
import android.widget.BaseAdapter;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.ListView;
|
import android.widget.ListView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
@@ -165,6 +165,10 @@ public class AppOpsCategory extends ListFragment implements
|
|||||||
* Handles a request to start the Loader.
|
* Handles a request to start the Loader.
|
||||||
*/
|
*/
|
||||||
@Override protected void onStartLoading() {
|
@Override protected void onStartLoading() {
|
||||||
|
// We don't monitor changed when loading is stopped, so need
|
||||||
|
// to always reload at this point.
|
||||||
|
onContentChanged();
|
||||||
|
|
||||||
if (mApps != null) {
|
if (mApps != null) {
|
||||||
// If we currently have a result available, deliver it
|
// If we currently have a result available, deliver it
|
||||||
// immediately.
|
// immediately.
|
||||||
@@ -239,33 +243,36 @@ public class AppOpsCategory extends ListFragment implements
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class AppListAdapter extends ArrayAdapter<AppOpEntry> {
|
public static class AppListAdapter extends BaseAdapter {
|
||||||
private final Resources mResources;
|
private final Resources mResources;
|
||||||
private final LayoutInflater mInflater;
|
private final LayoutInflater mInflater;
|
||||||
private final AppOpsState mState;
|
private final AppOpsState mState;
|
||||||
|
|
||||||
|
List<AppOpEntry> mList;
|
||||||
|
|
||||||
public AppListAdapter(Context context, AppOpsState state) {
|
public AppListAdapter(Context context, AppOpsState state) {
|
||||||
super(context, android.R.layout.simple_list_item_2);
|
|
||||||
mResources = context.getResources();
|
mResources = context.getResources();
|
||||||
mInflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
mInflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||||
mState = state;
|
mState = state;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setData(List<AppOpEntry> data) {
|
public void setData(List<AppOpEntry> data) {
|
||||||
clear();
|
mList = data;
|
||||||
if (data != null) {
|
notifyDataSetChanged();
|
||||||
addAll(data);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hasStableIds() {
|
public int getCount() {
|
||||||
return true;
|
return mList != null ? mList.size() : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AppOpEntry getItem(int position) {
|
||||||
|
return mList.get(position);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public long getItemId(int position) {
|
public long getItemId(int position) {
|
||||||
// XXX need to generate real id.
|
|
||||||
return position;
|
return position;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -315,16 +322,9 @@ public class AppOpsCategory extends ListFragment implements
|
|||||||
|
|
||||||
// Start out with a progress indicator.
|
// Start out with a progress indicator.
|
||||||
setListShown(false);
|
setListShown(false);
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
// Prepare the loader.
|
||||||
public void onStart() {
|
getLoaderManager().initLoader(0, null, this);
|
||||||
super.onStart();
|
|
||||||
|
|
||||||
// Prepare the loader. We don't monitor for changes while stopped,
|
|
||||||
// so want to re-start the loader (retrieving a new data set) each
|
|
||||||
// time we start.
|
|
||||||
getLoaderManager().restartLoader(0, null, this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// utility method used to start sub activity
|
// utility method used to start sub activity
|
||||||
|
@@ -151,11 +151,18 @@ public class AppOpsState {
|
|||||||
AppOpsManager.OP_ACCESS_NOTIFICATIONS,
|
AppOpsManager.OP_ACCESS_NOTIFICATIONS,
|
||||||
AppOpsManager.OP_CALL_PHONE,
|
AppOpsManager.OP_CALL_PHONE,
|
||||||
AppOpsManager.OP_WRITE_SETTINGS,
|
AppOpsManager.OP_WRITE_SETTINGS,
|
||||||
AppOpsManager.OP_SYSTEM_ALERT_WINDOW },
|
AppOpsManager.OP_SYSTEM_ALERT_WINDOW,
|
||||||
|
AppOpsManager.OP_CAMERA,
|
||||||
|
AppOpsManager.OP_RECORD_AUDIO,
|
||||||
|
AppOpsManager.OP_PLAY_AUDIO },
|
||||||
new boolean[] { false,
|
new boolean[] { false,
|
||||||
false,
|
false,
|
||||||
true,
|
true,
|
||||||
true,
|
true,
|
||||||
|
true,
|
||||||
|
true,
|
||||||
|
true,
|
||||||
|
true,
|
||||||
true }
|
true }
|
||||||
);
|
);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user