compileSdkVersion to 29
This commit is contained in:
parent
80be603f84
commit
84ad6ed535
|
|
@ -23,7 +23,7 @@ android {
|
|||
keyPassword pwd != null ? pwd : System.getenv("ALIAS_PASS")
|
||||
}
|
||||
}
|
||||
compileSdkVersion 28
|
||||
compileSdkVersion 29
|
||||
//noinspection GradleDependency
|
||||
buildToolsVersion "29.0.2"
|
||||
defaultConfig {
|
||||
|
|
|
|||
|
|
@ -1,19 +1,6 @@
|
|||
package android.os;
|
||||
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.zip.CRC32;
|
||||
import java.util.zip.CheckedInputStream;
|
||||
|
||||
@SuppressWarnings("ALL")
|
||||
@SuppressWarnings("unused")
|
||||
public class FileUtils {
|
||||
public static final int S_IRWXU = 448;
|
||||
public static final int S_IRUSR = 256;
|
||||
|
|
@ -27,148 +14,6 @@ public class FileUtils {
|
|||
public static final int S_IROTH = 4;
|
||||
public static final int S_IWOTH = 2;
|
||||
public static final int S_IXOTH = 1;
|
||||
private static final Pattern SAFE_FILENAME_PATTERN = Pattern.compile("[\\w%+,./=_-]+");
|
||||
|
||||
public static native int setPermissions(String paramString, int paramInt1, int paramInt2, int paramInt3);
|
||||
|
||||
public static native int getFatVolumeId(String paramString);
|
||||
|
||||
public static boolean sync(FileOutputStream stream) {
|
||||
try {
|
||||
if (stream != null)
|
||||
stream.getFD().sync();
|
||||
return true;
|
||||
} catch (IOException e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean copyFile(File srcFile, File destFile) {
|
||||
boolean result = false;
|
||||
try {
|
||||
InputStream in = new FileInputStream(srcFile);
|
||||
try {
|
||||
result = copyToFile(in, destFile);
|
||||
} finally {
|
||||
in.close();
|
||||
}
|
||||
} catch (IOException e) {
|
||||
result = false;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public static boolean copyToFile(InputStream inputStream, File destFile) {
|
||||
try {
|
||||
if (destFile.exists())
|
||||
destFile.delete();
|
||||
FileOutputStream out = new FileOutputStream(destFile);
|
||||
try {
|
||||
byte[] buffer = new byte[4096];
|
||||
int bytesRead;
|
||||
while ((bytesRead = inputStream.read(buffer)) >= 0)
|
||||
out.write(buffer, 0, bytesRead);
|
||||
} finally {
|
||||
out.flush();
|
||||
try {
|
||||
out.getFD().sync();
|
||||
} catch (IOException e) {
|
||||
}
|
||||
out.close();
|
||||
}
|
||||
return true;
|
||||
} catch (IOException e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isFilenameSafe(File file) {
|
||||
return SAFE_FILENAME_PATTERN.matcher(file.getPath()).matches();
|
||||
}
|
||||
|
||||
public static String readTextFile(File file, int max, String ellipsis) throws IOException {
|
||||
InputStream input = new FileInputStream(file);
|
||||
BufferedInputStream bis = new BufferedInputStream(input);
|
||||
try {
|
||||
long size = file.length();
|
||||
if (max > 0 || (size > 0L && max == 0)) {
|
||||
if (size > 0L && (max == 0 || size < max))
|
||||
max = (int) size;
|
||||
byte[] arrayOfByte = new byte[max + 1];
|
||||
int length = bis.read(arrayOfByte);
|
||||
if (length <= 0)
|
||||
return "";
|
||||
if (length <= max)
|
||||
return new String(arrayOfByte, 0, length);
|
||||
if (ellipsis == null)
|
||||
return new String(arrayOfByte, 0, max);
|
||||
return new String(arrayOfByte, 0, max) + ellipsis;
|
||||
}
|
||||
if (max < 0) {
|
||||
int len;
|
||||
boolean rolled = false;
|
||||
byte[] last = null, arrayOfByte1 = null;
|
||||
do {
|
||||
if (last != null)
|
||||
rolled = true;
|
||||
byte[] tmp = last;
|
||||
last = arrayOfByte1;
|
||||
arrayOfByte1 = tmp;
|
||||
if (arrayOfByte1 == null)
|
||||
arrayOfByte1 = new byte[-max];
|
||||
len = bis.read(arrayOfByte1);
|
||||
} while (len == arrayOfByte1.length);
|
||||
if (last == null && len <= 0)
|
||||
return "";
|
||||
if (last == null)
|
||||
return new String(arrayOfByte1, 0, len);
|
||||
if (len > 0) {
|
||||
rolled = true;
|
||||
System.arraycopy(last, len, last, 0, last.length - len);
|
||||
System.arraycopy(arrayOfByte1, 0, last, last.length - len, len);
|
||||
}
|
||||
if (ellipsis == null || !rolled)
|
||||
return new String(last);
|
||||
return ellipsis + new String(last);
|
||||
}
|
||||
ByteArrayOutputStream contents = new ByteArrayOutputStream();
|
||||
byte[] data = new byte[1024];
|
||||
while (true) {
|
||||
int len = bis.read(data);
|
||||
if (len > 0)
|
||||
contents.write(data, 0, len);
|
||||
if (len != data.length)
|
||||
return contents.toString();
|
||||
}
|
||||
} finally {
|
||||
bis.close();
|
||||
input.close();
|
||||
}
|
||||
}
|
||||
|
||||
public static void stringToFile(String filename, String string) throws IOException {
|
||||
FileWriter out = new FileWriter(filename);
|
||||
try {
|
||||
out.write(string);
|
||||
} finally {
|
||||
out.close();
|
||||
}
|
||||
}
|
||||
|
||||
public static long checksumCrc32(File file) throws FileNotFoundException, IOException {
|
||||
CRC32 checkSummer = new CRC32();
|
||||
CheckedInputStream cis = null;
|
||||
try {
|
||||
cis = new CheckedInputStream(new FileInputStream(file), checkSummer);
|
||||
byte[] buf = new byte[128];
|
||||
while (cis.read(buf) >= 0) ;
|
||||
return checkSummer.getValue();
|
||||
} finally {
|
||||
if (cis != null)
|
||||
try {
|
||||
cis.close();
|
||||
} catch (IOException e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -415,7 +415,7 @@ public class SettingsActivity extends BaseActivity {
|
|||
Activity activity = getActivity();
|
||||
if (activity != null) {
|
||||
Intent intent = new Intent();
|
||||
intent.putExtra("compat_list",true);
|
||||
intent.putExtra("compat_list", true);
|
||||
intent.setClass(activity, BlackListActivity.class);
|
||||
activity.startActivity(intent);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,14 +9,13 @@ import android.content.IntentFilter;
|
|||
import android.content.SharedPreferences;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.os.Bundle;
|
||||
import android.os.Environment;
|
||||
import android.os.FileUtils;
|
||||
import android.os.Handler;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.preference.PreferenceManager;
|
||||
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
|
||||
|
||||
import org.meowcat.edxposed.manager.receivers.PackageChangeReceiver;
|
||||
|
|
@ -119,7 +118,6 @@ public class XposedApp extends de.robv.android.xposed.installer.XposedApp implem
|
|||
|
||||
de.robv.android.xposed.installer.XposedApp.getInstance().reloadXposedProp();
|
||||
createDirectories();
|
||||
delete(new File(Environment.getExternalStorageDirectory() + "/Download/EdXposedManager/.temp"));
|
||||
NotificationUtil.init();
|
||||
registerReceivers();
|
||||
|
||||
|
|
@ -152,17 +150,6 @@ public class XposedApp extends de.robv.android.xposed.installer.XposedApp implem
|
|||
new Intent(this, PackageChangeReceiver.class), 0);
|
||||
}
|
||||
|
||||
private void delete(File file) {
|
||||
if (file != null) {
|
||||
if (file.isDirectory()) {
|
||||
File[] files = file.listFiles();
|
||||
if (files != null) for (File f : file.listFiles()) delete(f);
|
||||
}
|
||||
//noinspection ResultOfMethodCallIgnored
|
||||
file.delete();
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings({"JavaReflectionMemberAccess", "OctalInteger"})
|
||||
@SuppressLint({"PrivateApi", "NewApi"})
|
||||
private void createDirectories() {
|
||||
|
|
|
|||
|
|
@ -95,13 +95,12 @@ public abstract class CursorRecyclerViewAdapter<VH extends RecyclerView.ViewHold
|
|||
}
|
||||
rowIdColumn = newCursor.getColumnIndexOrThrow("_id");
|
||||
dataValid = true;
|
||||
notifyDataSetChanged();
|
||||
} else {
|
||||
rowIdColumn = -1;
|
||||
dataValid = false;
|
||||
notifyDataSetChanged();
|
||||
//There is no notifyDataSetInvalidated() method in RecyclerView.Adapter
|
||||
}
|
||||
notifyDataSetChanged();
|
||||
return oldCursor;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -18,17 +18,7 @@ public class BootReceiver extends BroadcastReceiver {
|
|||
|
||||
@Override
|
||||
public void onReceive(final Context context, Intent intent) {
|
||||
new android.os.Handler().postDelayed(() -> {
|
||||
if (!isOnline(context)) return;
|
||||
|
||||
new CheckUpdates().execute();
|
||||
}, 60 * 60 * 1000 /*60 min*/);
|
||||
}
|
||||
|
||||
private boolean isOnline(Context context) {
|
||||
ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
|
||||
NetworkInfo netInfo = cm.getActiveNetworkInfo();
|
||||
return netInfo != null && netInfo.isConnectedOrConnecting();
|
||||
new android.os.Handler().postDelayed(() -> new CheckUpdates().execute(), 60 * 60 * 1000 /*60 min*/);
|
||||
}
|
||||
|
||||
private static class CheckUpdates extends AsyncTask<Void, Void, Void> {
|
||||
|
|
@ -47,6 +37,7 @@ public class BootReceiver extends BroadcastReceiver {
|
|||
NotificationUtil.showInstallerUpdateNotification();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
//noinspection ConstantConditions
|
||||
Log.d(XposedApp.TAG, e.getMessage());
|
||||
}
|
||||
return null;
|
||||
|
|
|
|||
|
|
@ -52,7 +52,6 @@ public class DownloadsUtil {
|
|||
request.setDestinationUri(Uri.fromFile(destination));
|
||||
DownloadManager dm = (DownloadManager) context.getSystemService(Context.DOWNLOAD_SERVICE);
|
||||
long id = dm.enqueue(request);
|
||||
|
||||
return getById(context, id);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue