Skip to content
This repository has been archived by the owner on May 12, 2023. It is now read-only.

Commit

Permalink
Merge remote-tracking branch 'upstream/release' into release
Browse files Browse the repository at this point in the history
  • Loading branch information
AsdMonio committed Nov 7, 2018
2 parents 52bb446 + 128b75b commit 3dbb8cf
Show file tree
Hide file tree
Showing 58 changed files with 213 additions and 425 deletions.
3 changes: 1 addition & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@ language: android

jdk:
- openjdk8
- oraclejdk8

android:
components:
- tools
- build-tools-28.0.2
- build-tools-28.0.3
- android-28
- extra-google-m2repository
- extra-android-m2repository
Expand Down
57 changes: 33 additions & 24 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ android {
applicationId "projekt.substratum"
minSdkVersion 24
targetSdkVersion 28
versionCode 1007
versionName "one thousand seven"
versionCode 1009
versionName "one thousand nine"
buildConfigField "java.util.Date", "buildTime", "new java.util.Date(" + System.currentTimeMillis() + "L)"
buildConfigField "String", "GIT_HASH", "\"${gitHash()}\""
buildConfigField "boolean", "ENHANCED_LOGGING", "false"
Expand Down Expand Up @@ -93,11 +93,25 @@ android {
}

ext {
databindingVersion = '3.3.0-alpha08'
androidXVersion = '1.0.0-rc02'
firebaseVersion = '16.0.3'
aboutVersion = '6.0.9'
androidXVersion = '1.0.0'
apkSigVersion = '3.2.0'
caocVersion = '2.2.0'
commonsIoVersion = '2.5'
crashlyticsVersion = '2.9.5'
databindingVersion = '3.3.0-alpha08'
expandableLayoutVersion = '2.9.2'
fabSheetVersion = '1.2.1'
firebaseVersion = '16.0.4'
firebaseDBVersion = '16.0.3'
floatingHeadVersion = '2.3.2'
gestureRecyclerVersion = '1.5.0'
glideVersion = '4.8.0'
imageCropperVersion = '2.7.0'
slf4jVersion = '1.7.16'
svgViewVersion = '1.0.5'
welcomeVersion = '1.4.1'
ztZipVersion = '1.13'
}

dependencies {
Expand All @@ -106,17 +120,14 @@ dependencies {
// Android Support Libraries
implementation "androidx.databinding:databinding-runtime:$databindingVersion"
implementation "androidx.appcompat:appcompat:$androidXVersion"
implementation "androidx.exifinterface:exifinterface:$androidXVersion"
implementation "androidx.cardview:cardview:$androidXVersion"
implementation "androidx.recyclerview:recyclerview:$androidXVersion"
implementation "androidx.legacy:legacy-support-v13:$androidXVersion"
implementation "com.google.android.material:material:$androidXVersion"
implementation "androidx.palette:palette:$androidXVersion"
implementation "androidx.legacy:legacy-preference-v14:$androidXVersion"

// Firebase
implementation "com.google.firebase:firebase-core:$firebaseVersion"
implementation "com.google.firebase:firebase-database:16.0.1"
implementation "com.google.firebase:firebase-database:$firebaseDBVersion"

// Crashlytics
implementation "com.crashlytics.sdk.android:crashlytics:$crashlyticsVersion"
Expand All @@ -126,46 +137,44 @@ dependencies {
annotationProcessor "com.github.bumptech.glide:compiler:$glideVersion"

// Commons IO
//noinspection GradleDependency
implementation 'commons-io:commons-io:2.5'
implementation "commons-io:commons-io:$commonsIoVersion"

// APK Signer
implementation 'com.android.tools.build:apksig:3.1.4'
implementation "com.android.tools.build:apksig:$apkSigVersion"

// App Intro
implementation 'com.stephentuso:welcome:1.4.1'
implementation "com.stephentuso:welcome:$welcomeVersion"

// Floating Action Buttons
implementation 'com.gordonwong:material-sheet-fab:1.2.1'
implementation "com.gordonwong:material-sheet-fab:$fabSheetVersion"

// About Libraries
implementation('com.mikepenz:aboutlibraries:6.0.9@aar') {
implementation("com.mikepenz:aboutlibraries:$aboutVersion@aar") {
transitive = true
}

// Gesture RecyclerView
implementation 'com.thesurix.gesturerecycler:gesture-recycler:1.5.0'
implementation "com.thesurix.gesturerecycler:gesture-recycler:$gestureRecyclerVersion"

// ZT Zip
//noinspection GradleDependency
implementation 'org.zeroturnaround:zt-zip:1.13'
implementation "org.zeroturnaround:zt-zip:$ztZipVersion"

// Image Processing
implementation 'com.theartofdev.edmodo:android-image-cropper:2.7.0'
implementation "com.theartofdev.edmodo:android-image-cropper:$imageCropperVersion"

// Expandable Layout
implementation 'net.cachapa.expandablelayout:expandablelayout:2.9.2'
implementation "net.cachapa.expandablelayout:expandablelayout:$expandableLayoutVersion"

// Floating App Head
implementation 'com.github.recruit-lifestyle:FloatingView:2.3.2'
implementation "com.github.recruit-lifestyle:FloatingView:$floatingHeadVersion"

// Crash Activity
implementation 'cat.ereza:customactivityoncrash:2.2.0'
implementation "cat.ereza:customactivityoncrash:$caocVersion"

// Splash screen svg animation
implementation 'com.jaredrummler:animated-svg-view:1.0.5'
implementation "com.jaredrummler:animated-svg-view:$svgViewVersion"

// SLF4J LoggerFactory
implementation 'org.slf4j:slf4j-api:1.7.16'
implementation "org.slf4j:slf4j-api:$slf4jVersion"
}
apply plugin: 'com.google.gms.google-services'
5 changes: 3 additions & 2 deletions app/src/main/java/projekt/substratum/InformationActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -789,7 +789,8 @@ public void onTabReselected(TabLayout.Tab tab) {
localBroadcastManager.sendBroadcast(intent);
});

if (!Systems.checkOMS(this)) compileEnableSelected.setVisibility(View.GONE);
if (!Systems.checkOMS(this) || (Systems.IS_PIE && !Systems.checkSubstratumService(context) && !BuildConfig.DEBUG))
compileEnableSelected.setVisibility(View.GONE);
compileEnableSelected.setOnClickListener(v -> {
materialSheetFab.setEventListener(new MaterialSheetFabEventListener() {
@Override
Expand Down Expand Up @@ -922,7 +923,7 @@ public boolean onCreateOptionsMenu(Menu menu) {
PorterDuff.Mode.SRC_ATOP);
}

if (Systems.checkAndromeda(context) ||
if (Systems.isAndromedaDevice(context) ||
(!isOMS && !Root.checkRootAccess())) {
menu.findItem(R.id.restart_systemui).setVisible(false);
}
Expand Down
23 changes: 14 additions & 9 deletions app/src/main/java/projekt/substratum/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,10 @@
import static projekt.substratum.common.References.SUBSTRATUM_BUILDER;
import static projekt.substratum.common.References.SUBSTRATUM_BUILDER_CACHE;
import static projekt.substratum.common.References.SUBSTRATUM_LOG;
import static projekt.substratum.common.Systems.checkAndromeda;
import static projekt.substratum.common.Systems.checkSubstratumServiceApi;
import static projekt.substratum.common.Systems.checkThemeSystemModule;
import static projekt.substratum.common.Systems.checkUsagePermissions;
import static projekt.substratum.common.Systems.isAndromedaDevice;
import static projekt.substratum.common.Systems.isSamsung;
import static projekt.substratum.common.Systems.isSamsungDevice;
import static projekt.substratum.common.commands.FileOperations.delete;
Expand All @@ -123,6 +123,7 @@ public class MainActivity extends AppCompatActivity implements
private static final int PERMISSIONS_REQUEST_USAGE_ACCESS_SETTINGS = 3;
private static final int UNINSTALL_REQUEST_CODE = 12675;
private static final String SELECTED_TAB_ITEM = "selected_tab_item";
private static final SharedPreferences prefs = Substratum.getPreferences();
public static String userInput = "";
public static ArrayList<String> queuedUninstall;
public static boolean instanceBasedAndromedaFailure;
Expand All @@ -134,7 +135,6 @@ public class MainActivity extends AppCompatActivity implements
private ActionBar supportActionBar;
private int permissionCheck = PackageManager.PERMISSION_DENIED;
private Dialog progressDialog;
private static final SharedPreferences prefs = Substratum.getPreferences();
private LocalBroadcastManager localBroadcastManager;
private KillReceiver killReceiver;
private AndromedaReceiver andromedaReceiver;
Expand Down Expand Up @@ -383,7 +383,7 @@ protected void onCreate(Bundle savedInstanceState) {
.setPositiveButton(R.string.dialog_ok, (dialogInterface, i) -> {
try {
startActivity(
new Intent(ACTION_APPLICATION_DEVELOPMENT_SETTINGS));
new Intent(ACTION_APPLICATION_DEVELOPMENT_SETTINGS));
} catch (ActivityNotFoundException ignored /* People with developer options disabled */) {
Toast.makeText(this, this.getString(R.string.development_settings_disabled), Toast.LENGTH_LONG).show();
} finally {
Expand Down Expand Up @@ -904,7 +904,7 @@ private void permissionCheck() {
}

if (Systems.checkOMS(context) &&
Systems.isXiaomiDevice(context) &&
Systems.isXiaomiDevice() &&
!prefs.contains("xiaomi_enable_development")) {
AlertDialog.Builder alert = new AlertDialog.Builder(activity);
alert.setTitle(R.string.warning_title);
Expand Down Expand Up @@ -978,16 +978,19 @@ private void permissionCheck() {
}

if (Systems.checkOMS(context) &&
Systems.isXiaomiDevice(context) &&
Systems.isXiaomiDevice() &&
!prefs.contains("xiaomi_enable_development")) {
AlertDialog.Builder alert = new AlertDialog.Builder(activity);
alert.setTitle(R.string.warning_title);
alert.setMessage(R.string.xiaomi_warning_content);
alert.setPositiveButton(R.string.dialog_ok,
(dialog2, i2) -> dialog2.cancel());
alert.setNegativeButton(R.string.dialog_check, (dialog, which) -> {
activity.startActivity(
new Intent(ACTION_APPLICATION_DEVELOPMENT_SETTINGS));
try {
activity.startActivity(new Intent(ACTION_APPLICATION_DEVELOPMENT_SETTINGS));
} catch (ActivityNotFoundException ignored) {
Toast.makeText(context, R.string.development_settings_disabled, Toast.LENGTH_LONG).show();
}
activity.finishAffinity();
});
alert.setNeutralButton(R.string.dialog_do_not_show_again,
Expand Down Expand Up @@ -1076,12 +1079,14 @@ private void showDialogOrNot(boolean passthrough) {
textView.setVisibility(View.GONE);
titleView.setVisibility(View.GONE);
} else if (Systems.isAndromedaDevice(context) &&
(!AndromedaService.checkServerActivity() || prefs.getBoolean("sungstromeda_mode", false))) {
(Systems.isNewSamsungDeviceAndromeda(context) ?
!prefs.getBoolean("sungstromeda_mode", false) :
!AndromedaService.checkServerActivity())) {
TextView andromedaTitle = activity.progressDialog.findViewById(R.id.andromeda_title);
Button andromedaOfflineButton = activity.progressDialog.findViewById(R.id.andromeda_offline_button);
TextView andromedaDebugText = activity.progressDialog.findViewById(R.id.andromeda_debug_text);
andromedaTitle.setVisibility(View.VISIBLE);
if (!checkAndromeda(context)) {
if (!isAndromedaDevice(context)) {
andromedaTitle.setText(R.string.andromeda_no_firebase);
appCloseButton.setVisibility(View.VISIBLE);
} else {
Expand Down
33 changes: 21 additions & 12 deletions app/src/main/java/projekt/substratum/Substratum.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
import android.content.pm.PackageManager;
import android.media.AudioAttributes;
import android.os.Build;
import android.os.Handler;
import android.os.Process;
import android.preference.PreferenceManager;
import android.util.Log;
import androidx.appcompat.app.AppCompatDelegate;
Expand Down Expand Up @@ -161,20 +163,12 @@ public void run() {
currentThread.start();
}

private void configureCrashReporting() {
CrashlyticsCore crashlyticsCore = new CrashlyticsCore.Builder()
.disabled(BuildConfig.DEBUG)
.build();

Fabric.with(this, new Crashlytics.Builder().core(crashlyticsCore).build());
}

/**
* Restart the application after a change that requires a full exit.
*
* @param context Duh
*/
public static void restartSubstratum(Context context) {
public static void restartSubstratum(Context context, long delay) {
PackageManager pm = context.getPackageManager();
Intent startActivity = pm.getLaunchIntentForPackage(context.getPackageName());

Expand All @@ -186,20 +180,35 @@ public static void restartSubstratum(Context context) {
PendingIntent.getActivity(context,
0, startActivity, PendingIntent.FLAG_CANCEL_CURRENT);
AlarmManager mgr = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
if (mgr != null) mgr.set(AlarmManager.RTC, System.currentTimeMillis() + 10, mPendingIntent);
if (mgr != null)
mgr.set(AlarmManager.ELAPSED_REALTIME, System.currentTimeMillis() + 10, mPendingIntent);

// Kill the application
System.exit(0);
new Handler().postDelayed(() -> Process.killProcess(Process.myPid()), delay);
}

public static SharedPreferences getPreferences() { return preferences; }
public static void restartSubstratum(Context context) {
restartSubstratum(context, 100L);
}

public static SharedPreferences getPreferences() {
return preferences;
}

public static void log(final String TAG, final String message) {
if (!BuildConfig.DEBUG)
return;
Log.d(TAG, message);
}

private void configureCrashReporting() {
CrashlyticsCore crashlyticsCore = new CrashlyticsCore.Builder()
.disabled(BuildConfig.DEBUG)
.build();

Fabric.with(this, new Crashlytics.Builder().core(crashlyticsCore).build());
}

@Override
public void onCreate() {
super.onCreate();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,11 @@

import static projekt.substratum.common.Internal.AUTHENTICATED_RECEIVER;
import static projekt.substratum.common.Internal.AUTHENTICATE_RECEIVER;
import static projekt.substratum.common.References.ANDROMEDA_PACKAGE;
import static projekt.substratum.common.References.PLAY_STORE_PACKAGE_NAME;
import static projekt.substratum.common.References.SST_ADDON_PACKAGE;
import static projekt.substratum.common.References.SUBSTRATUM_LOG;
import static projekt.substratum.common.Systems.checkPackageSupport;
import static projekt.substratum.common.Systems.checkThemeSystemModule;
import static projekt.substratum.common.Systems.isAndromedaDevice;
import static projekt.substratum.common.Systems.isSamsungDevice;
import static projekt.substratum.common.analytics.FirebaseAnalytics.PACKAGES_PREFS;
import static projekt.substratum.common.analytics.PackageAnalytics.isLowEnd;
Expand Down Expand Up @@ -163,57 +161,8 @@ protected Void doInBackground(Void... voids) {
Substratum.log(SUBSTRATUM_LOG, "Successfully withdrew blacklisted packages!");
}

if (isAndromedaDevice(context)) {
int andromedaVer = Packages.getAppVersionCode(context, ANDROMEDA_PACKAGE);
FirebaseAnalytics.withdrawAndromedaFingerprint(context, andromedaVer);
SharedPreferences prefs2 = context.getSharedPreferences("substratum_state", Context.MODE_PRIVATE);
timeoutCount = 0;
while (!prefs2.contains("andromeda_exp_fp_" + andromedaVer) &&
(timeoutCount < 100)) {
try {
Thread.sleep(100L);
} catch (InterruptedException e) {
e.printStackTrace();
}
timeoutCount++;
}
if (!prefs2.contains("andromeda_exp_fp_" + andromedaVer)) {
Log.e(SUBSTRATUM_LOG, "Failed to withdraw andromeda fingerprint...");
} else {
String installed_directory =
Packages.getInstalledDirectory(context, ANDROMEDA_PACKAGE);
if (installed_directory != null) {
prefs2.edit()
.putString("andromeda_fp",
MD5.calculateMD5(new File(installed_directory)))
.putString("andromeda_installer", context.getPackageManager()
.getInstallerPackageName(ANDROMEDA_PACKAGE))
.apply();
Substratum.log(SUBSTRATUM_LOG, "Successfully approved andromeda fingerprint!");
}
}
}

if (isSamsungDevice(context) &&
Packages.isPackageInstalled(context, SST_ADDON_PACKAGE)) {
int sstVersion = Packages.getAppVersionCode(context, SST_ADDON_PACKAGE);
FirebaseAnalytics.withdrawSungstratumFingerprint(context, sstVersion);
SharedPreferences prefs2 = context.getSharedPreferences("substratum_state", Context.MODE_PRIVATE);
timeoutCount = 0;
while (!prefs2.contains("sungstratum_exp_fp_" + sstVersion) && (timeoutCount <
100)) {
try {
Thread.sleep(100L);
} catch (InterruptedException e) {
e.printStackTrace();
}
timeoutCount++;
}
if (!prefs2.contains("sungstratum_exp_fp_" + sstVersion)) {
Log.e(SUBSTRATUM_LOG, "Failed to withdraw sungstratum fingerprint...");
} else {
Substratum.log(SUBSTRATUM_LOG, "Successfully approved sungstratum fingerprint!");
}

keyRetrieval = new KeyRetrieval();
IntentFilter filter = new IntentFilter(AUTHENTICATED_RECEIVER);
Expand Down
Loading

0 comments on commit 3dbb8cf

Please sign in to comment.