Loading src/com/android/settings/applications/ProtectedAppsActivity.java +22 −8 Original line number Diff line number Diff line Loading @@ -20,7 +20,6 @@ import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.CheckBox; import android.widget.ImageView; import android.widget.ListView; Loading @@ -30,6 +29,7 @@ import com.android.settings.cyanogenmod.ProtectedAppsReceiver; import java.util.ArrayList; import java.util.Collections; import java.util.HashSet; import java.util.List; import java.util.concurrent.ConcurrentHashMap; Loading @@ -50,6 +50,8 @@ public class ProtectedAppsActivity extends Activity { private boolean mWaitUserAuth = false; private HashSet<ComponentName> mProtectedApps = new HashSet<ComponentName>(); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Loading Loading @@ -92,6 +94,23 @@ public class ProtectedAppsActivity extends Activity { refreshAppsTask.execute(null, null, null); getActionBar().setDisplayHomeAsUpEnabled(true); // Update Protected Apps list updateProtectedComponentsList(); } private void updateProtectedComponentsList() { String protectedComponents = Settings.Secure.getString(getContentResolver(), Settings.Secure.PROTECTED_COMPONENTS); protectedComponents = protectedComponents == null ? "" : protectedComponents; String [] flattened = protectedComponents.split("\\|"); mProtectedApps = new HashSet<ComponentName>(flattened.length); for (String flat : flattened) { ComponentName cmp = ComponentName.unflattenFromString(flat); if (cmp != null) { mProtectedApps.add(cmp); } } } @Override Loading @@ -105,13 +124,7 @@ public class ProtectedAppsActivity extends Activity { } private boolean getProtectedStateFromComponentName(ComponentName componentName) { PackageManager pm = getPackageManager(); try { return pm.getApplicationInfo(componentName.getPackageName(), 0).protect; } catch (PackageManager.NameNotFoundException e) { return false; } return mProtectedApps.contains(componentName); } @Override Loading Loading @@ -263,6 +276,7 @@ public class ProtectedAppsActivity extends Activity { appList.componentNames, appList.state); } updateProtectedComponentsList(); return null; } } Loading Loading
src/com/android/settings/applications/ProtectedAppsActivity.java +22 −8 Original line number Diff line number Diff line Loading @@ -20,7 +20,6 @@ import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.CheckBox; import android.widget.ImageView; import android.widget.ListView; Loading @@ -30,6 +29,7 @@ import com.android.settings.cyanogenmod.ProtectedAppsReceiver; import java.util.ArrayList; import java.util.Collections; import java.util.HashSet; import java.util.List; import java.util.concurrent.ConcurrentHashMap; Loading @@ -50,6 +50,8 @@ public class ProtectedAppsActivity extends Activity { private boolean mWaitUserAuth = false; private HashSet<ComponentName> mProtectedApps = new HashSet<ComponentName>(); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Loading Loading @@ -92,6 +94,23 @@ public class ProtectedAppsActivity extends Activity { refreshAppsTask.execute(null, null, null); getActionBar().setDisplayHomeAsUpEnabled(true); // Update Protected Apps list updateProtectedComponentsList(); } private void updateProtectedComponentsList() { String protectedComponents = Settings.Secure.getString(getContentResolver(), Settings.Secure.PROTECTED_COMPONENTS); protectedComponents = protectedComponents == null ? "" : protectedComponents; String [] flattened = protectedComponents.split("\\|"); mProtectedApps = new HashSet<ComponentName>(flattened.length); for (String flat : flattened) { ComponentName cmp = ComponentName.unflattenFromString(flat); if (cmp != null) { mProtectedApps.add(cmp); } } } @Override Loading @@ -105,13 +124,7 @@ public class ProtectedAppsActivity extends Activity { } private boolean getProtectedStateFromComponentName(ComponentName componentName) { PackageManager pm = getPackageManager(); try { return pm.getApplicationInfo(componentName.getPackageName(), 0).protect; } catch (PackageManager.NameNotFoundException e) { return false; } return mProtectedApps.contains(componentName); } @Override Loading Loading @@ -263,6 +276,7 @@ public class ProtectedAppsActivity extends Activity { appList.componentNames, appList.state); } updateProtectedComponentsList(); return null; } } Loading