Improve IntentHelper openFile debug log, and use 64bit secret instead of 32bit secret.

pull/27/head
Fox2Code 4 years ago
parent 5f2c2ffb4a
commit b81509dd32

@ -51,7 +51,7 @@ public class MainApplication extends Application implements CompatActivity.Appli
private static SimpleDateFormat timeFormat = private static SimpleDateFormat timeFormat =
new SimpleDateFormat(timeFormatString, timeFormatLocale); new SimpleDateFormat(timeFormatString, timeFormatLocale);
private static final Shell.Builder shellBuilder; private static final Shell.Builder shellBuilder;
private static final int secret; private static final long secret;
private static SharedPreferences bootSharedPreferences; private static SharedPreferences bootSharedPreferences;
private static MainApplication INSTANCE; private static MainApplication INSTANCE;
private static boolean firstBoot; private static boolean firstBoot;
@ -61,7 +61,7 @@ public class MainApplication extends Application implements CompatActivity.Appli
.setFlags(Shell.FLAG_REDIRECT_STDERR) .setFlags(Shell.FLAG_REDIRECT_STDERR)
.setTimeout(10).setInitializers(InstallerInitializer.class) .setTimeout(10).setInitializers(InstallerInitializer.class)
); );
secret = new Random().nextInt(); secret = new Random().nextLong();
} }
public MainApplication() { public MainApplication() {
@ -79,7 +79,7 @@ public class MainApplication extends Application implements CompatActivity.Appli
} }
public static boolean checkSecret(Intent intent) { public static boolean checkSecret(Intent intent) {
return intent.getIntExtra("secret", ~secret) == secret; return intent.getLongExtra("secret", ~secret) == secret;
} }
public static SharedPreferences getSharedPreferences() { public static SharedPreferences getSharedPreferences() {

@ -208,7 +208,7 @@ public class IntentHelper {
Files.copy(inputStream, outputStream); Files.copy(inputStream, outputStream);
success = true; success = true;
} catch (Exception e) { } catch (Exception e) {
Log.e("IntentHelper", "fail copy", e); Log.e("IntentHelper", "failed copy of " + uri, e);
Toast.makeText(compatActivity, Toast.makeText(compatActivity,
R.string.file_picker_failure, R.string.file_picker_failure,
Toast.LENGTH_SHORT).show(); Toast.LENGTH_SHORT).show();

Loading…
Cancel
Save