Skip to content

Commit

Permalink
pff: Infrastructure needed for permission spoofing
Browse files Browse the repository at this point in the history
- NullPointerException fix for permissions that cost money
  • Loading branch information
guhl authored and guhl committed Jan 8, 2014
1 parent a9b105e commit 0650231
Showing 1 changed file with 22 additions and 20 deletions.
42 changes: 22 additions & 20 deletions core/java/android/widget/AppSecurityPermissions.java
Expand Up @@ -293,25 +293,27 @@ public void setPermission(MyPermissionGroupInfo grp, MyPermissionInfo perm,
ImageView permGrpIcon = (ImageView) findViewById(R.id.perm_icon);
TextView permNameView = (TextView) findViewById(R.id.perm_name);
Switch spoofSwitch = (Switch) findViewById(R.id.spoof_button);
spoofSwitch.setText("Spoof");
spoofSwitch.setTag(perm);
spoofSwitch.setOnCheckedChangeListener(mEditableChangeListener);
if (mSpoofablePerms.contains(perm.name)) {
Log.i(TAG, "pff: PermissionItemView.setPermission perm.name=" +
perm.name + " spoofable");
} else {
Log.i(TAG, "pff: PermissionItemView.setPermission perm.name=" +
perm.name + " not spoofable");
}
spoofSwitch.setVisibility(mSpoofablePerms.contains(perm.name) ? View.VISIBLE : View.GONE);
if (mSpoofedPerms.contains(perm.name)) {
Log.i(TAG, "pff: PermissionItemView.setPermission perm.name=" +
perm.name + " spoofed");
spoofSwitch.setChecked(true);
} else {
Log.i(TAG, "pff: PermissionItemView.setPermission perm.name=" +
perm.name + " not spoofed");
spoofSwitch.setChecked(false);
if (null != spoofSwitch){
spoofSwitch.setText("Spoof");
spoofSwitch.setTag(perm);
spoofSwitch.setOnCheckedChangeListener(mEditableChangeListener);
if (mSpoofablePerms.contains(perm.name)) {
Log.i(TAG, "pff: PermissionItemView.setPermission perm.name=" +
perm.name + " spoofable");
} else {
Log.i(TAG, "pff: PermissionItemView.setPermission perm.name=" +
perm.name + " not spoofable");
}
spoofSwitch.setVisibility(mSpoofablePerms.contains(perm.name) ? View.VISIBLE : View.GONE);
if (mSpoofedPerms.contains(perm.name)) {
Log.i(TAG, "pff: PermissionItemView.setPermission perm.name=" +
perm.name + " spoofed");
spoofSwitch.setChecked(true);
} else {
Log.i(TAG, "pff: PermissionItemView.setPermission perm.name=" +
perm.name + " not spoofed");
spoofSwitch.setChecked(false);
}
}
Drawable icon = null;
if (first) {
Expand Down Expand Up @@ -450,7 +452,7 @@ public AppSecurityPermissions(Context context, String packageName) {
mPermsList.addAll(permSet);
for(MyPermissionInfo tmpInfo : permSet) {
MyPermissionInfo myPerm = new MyPermissionInfo(tmpInfo);
Log.i(TAG, "AppSecurityPermissions(Context context, String packageName) - myPerm.packageName="+myPerm.packageName);
Log.i(TAG, "AppSecurityPermissions(Context context, String packageName) - myPerm.name="+myPerm.name+", setting myPerm.packageName="+packageName);
myPerm.packageName = packageName;
mPermsList.add(myPerm);
}
Expand Down

0 comments on commit 0650231

Please sign in to comment.