[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [orbot/master] ensure appmgr doesn't fail on loading apps



commit 8445f2e55dc01762f03cc4f0349412c039e32ce4
Author: Nathan Freitas <nathan@xxxxxxxxxxx>
Date:   Wed Apr 9 09:10:56 2014 -0400

    ensure appmgr doesn't fail on loading apps
    also don't load icons to improve memory usage
---
 .../torproject/android/settings/AppManager.java    |   21 ++++++++++++++++----
 1 file changed, 17 insertions(+), 4 deletions(-)

diff --git a/src/org/torproject/android/settings/AppManager.java b/src/org/torproject/android/settings/AppManager.java
index 7121e5e..6e2b90b 100644
--- a/src/org/torproject/android/settings/AppManager.java
+++ b/src/org/torproject/android/settings/AppManager.java
@@ -113,8 +113,11 @@ public class AppManager extends Activity implements OnCheckedChangeListener, OnC
         		
         		final TorifiedApp app = mApps.get(position);
         		
-        	
-        		entry.icon.setImageDrawable(app.getIcon());
+        		if (app.getIcon() != null)
+        			entry.icon.setImageDrawable(app.getIcon());
+        		else
+        			entry.icon.setVisibility(View.GONE);
+        		
         		entry.text.setText(app.getName());
         		
         		final CheckBox box = entry.box;
@@ -227,8 +230,18 @@ public class AppManager extends Activity implements OnCheckedChangeListener, OnC
 			app.setUid(aInfo.uid);
 			app.setUsername(pMgr.getNameForUid(app.getUid()));
 			app.setProcname(aInfo.processName);
-			app.setName(pMgr.getApplicationLabel(aInfo).toString());
-			app.setIcon(pMgr.getApplicationIcon(aInfo));
+			
+			try
+			{
+				app.setName(pMgr.getApplicationLabel(aInfo).toString());
+			}
+			catch (Exception e)
+			{
+				app.setName(aInfo.packageName);
+			}
+			
+			
+			//app.setIcon(pMgr.getApplicationIcon(aInfo));
 			
 			// check if this application is allowed
 			if (Arrays.binarySearch(tordApps, app.getUsername()) >= 0) {



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits