let $PREFIX/tmp be cleaned when TermuxService is going to be stopped

This commit is contained in:
Leonid Plyushch
2019-05-21 21:17:51 +03:00
committed by Fredrik Fornwall
parent 9f79393aa5
commit 514f59258a

View File

@@ -237,6 +237,18 @@ public final class TermuxService extends Service implements SessionChangedCallba
@Override
public void onDestroy() {
File termuxTmpDir = new File(TermuxService.PREFIX_PATH + "/tmp");
if (termuxTmpDir.exists()) {
try {
TermuxInstaller.deleteFolder(termuxTmpDir.getCanonicalFile());
} catch (Exception e) {
Log.e(EmulatorDebug.LOG_TAG, "Error while removing directory " + termuxTmpDir.getAbsolutePath(), e);
}
termuxTmpDir.mkdirs();
}
if (mWakeLock != null) mWakeLock.release();
if (mWifiLock != null) mWifiLock.release();