Skip to content

Commit

Permalink
Launcher bits
Browse files Browse the repository at this point in the history
  • Loading branch information
chedim committed Nov 22, 2023
1 parent 473ec52 commit ca969cf
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 43 deletions.
42 changes: 0 additions & 42 deletions app/src/main/java/com/termux/app/TermuxInstaller.java
Original file line number Diff line number Diff line change
Expand Up @@ -387,48 +387,6 @@ public void run() {
}.start();
}

public static void setupAppListCache(final Context context) {
final String LOG_TAG = "termux-applist";
final String APPLIST_CACHE_FILE = ".apps";
new Thread() {
public void run() {
try {

final File targetFile = new File(TermuxService.HOME_PATH, APPLIST_CACHE_FILE);
final FileOutputStream outStream = new FileOutputStream(targetFile);
final PrintStream printStream = new PrintStream(outStream);

final PackageManager pm = context.getPackageManager();
List<ApplicationInfo> packages = pm.getInstalledApplications(PackageManager.GET_META_DATA);
for (ApplicationInfo packageInfo : packages) {
final String packageName = packageInfo.packageName;
final String appName = packageInfo.loadLabel(pm).toString();
final String sourceDir = packageInfo.sourceDir;
final Intent LaunchActivity = pm.getLaunchIntentForPackage(packageName);
final Boolean isSystemApp = ((packageInfo.flags & ApplicationInfo.FLAG_SYSTEM) == 1) ? true : false;

Log.d(LOG_TAG, "[" + LaunchActivity + "] : [" + packageName + "] : [" + isSystemApp + "] : [" + appName + "]");
if (LaunchActivity == null) {
continue;
}

final String LaunchComponent = LaunchActivity.getComponent().flattenToShortString();
printStream.print( appName + "|" + LaunchComponent + "|" + packageName + "|" + isSystemApp + "\n");
} // for package in packages

// close file
printStream.flush();
printStream.close();
outStream.flush();
outStream.close();

} catch (Exception e) {
Log.e(LOG_TAG, "Error setting up applist-cache", e);
}
}
}.start();
};

private static Error ensureDirectoryExists(File directory) {
return FileUtils.createDirectoryFile(directory.getAbsolutePath());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ public static void createHomeDir(@NonNull Context context, @NonNull HashMap<Stri
Logger.logErrorExtended(LOG_TAG, "Failed to create shell home directory\n" + error.toString());
}

if (!FileUtils.directoryFileExists(homeDirectory + "/.bashrc", true)) {
if (!FileUtils.fileExists(homeDirectory + "/.bashrc", true)) {
FileUtils.copyResourceToFile(context, R.raw.bashrc, homeDirectory + "/.bashrc", Charset.defaultCharset());
}
setupAppListCache(context, true);
Expand Down

0 comments on commit ca969cf

Please sign in to comment.