Skip to content

Commit

Permalink
Users can't select Orbot itself through the VPN app manager. It is im…
Browse files Browse the repository at this point in the history
…possible (explained in #151) + and selecting won't do anyhting but mislead users
  • Loading branch information
bitmold committed Jul 24, 2020
1 parent dc536fc commit dac9b51
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1220,8 +1220,7 @@ private void addAppShortcuts() {
for (final String pkgId : pkgIds) {
try {
ApplicationInfo aInfo = getPackageManager().getApplicationInfo(pkgId, 0);
// skip disabled packages
if (!aInfo.enabled) continue;
if (!AppManagerActivity.includeAppInUi(aInfo)) continue;
ImageView iv = new ImageView(this);
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT);
params.setMargins(3, 3, 3, 3);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
import android.widget.ListAdapter;
import android.widget.ProgressBar;
import android.widget.TextView;

import org.torproject.android.BuildConfig;
import org.torproject.android.R;
import org.torproject.android.service.OrbotConstants;
import org.torproject.android.service.util.Prefs;
Expand Down Expand Up @@ -229,8 +231,7 @@ public ArrayList<TorifiedApp> getApps(SharedPreferences prefs) {
while (itAppInfo.hasNext())
{
aInfo = itAppInfo.next();
// don't include apps user has disabled, often these ship with the device
if (!aInfo.enabled) continue;
if (!includeAppInUi(aInfo)) continue;
app = new TorifiedApp();


Expand All @@ -246,7 +247,6 @@ public ArrayList<TorifiedApp> getApps(SharedPreferences prefs) {
app.setUsesInternet(true);
}
}

}


Expand Down Expand Up @@ -339,4 +339,12 @@ else if (v.getTag() instanceof CheckBox)
saveAppSettings();
}
}

// returns true if the given app is enabled and not orbot
public static boolean includeAppInUi(ApplicationInfo applicationInfo) {
if (!applicationInfo.enabled) return false;
if (BuildConfig.APPLICATION_ID.equals(applicationInfo.packageName)) return false;
return true;
}

}

0 comments on commit dac9b51

Please sign in to comment.