Skip to content

Commit

Permalink
Dependency updates + targetSdkVersion 34
Browse files Browse the repository at this point in the history
  • Loading branch information
farmerbb committed Sep 11, 2024
1 parent 8f39508 commit d8e0b40
Show file tree
Hide file tree
Showing 12 changed files with 298 additions and 208 deletions.
35 changes: 21 additions & 14 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,30 +9,35 @@ repositories {
}

android {
compileSdkVersion 31
buildToolsVersion "31.0.0"
compileSdk 34
namespace "com.farmerbb.secondscreen"

defaultConfig {
applicationId "com.farmerbb.secondscreen"
minSdkVersion 17
minSdkVersion 21

//noinspection OldTargetApi
targetSdkVersion 31
targetSdkVersion 34

versionCode 185
versionName "2.9.3"

resConfigs "en", "es", "fr", "sk", "nl", "it", "zh"
vectorDrawables.useSupportLibrary = true

buildConfigField "float", "TESTED_API_VERSION", "33.0f"
buildConfigField "float", "TESTED_API_VERSION", "35.0f"
buildConfigField "String", "SUPPORT_APPLICATION_ID", "\"com.farmerbb.secondscreen.support\""
buildConfigField "long", "TIMESTAMP", "${System.currentTimeMillis()}L"
}

buildFeatures {
buildConfig true
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
coreLibraryDesugaringEnabled true
sourceCompatibility JavaVersion.VERSION_21
targetCompatibility JavaVersion.VERSION_21
}

signingConfigs {
Expand All @@ -55,7 +60,7 @@ android {
release {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
manifestPlaceholders = [appName: "@string/app_name"]

Expand Down Expand Up @@ -93,16 +98,18 @@ android {
}

dependencies {
def shizuku_version = '12.0.0'
def shizuku_version = '12.1.0'

implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.appcompat:appcompat:1.3.1'
implementation 'com.google.android.material:material:1.4.0'
implementation 'androidx.appcompat:appcompat:1.7.0'
implementation 'com.google.android.material:material:1.12.0'
implementation "dev.rikka.shizuku:api:$shizuku_version"
implementation "dev.rikka.shizuku:provider:$shizuku_version"
implementation 'org.apache.commons:commons-lang3:3.12.0'
implementation 'eu.chainfire:libsuperuser:1.1.0.202004101746'
implementation 'org.apache.commons:commons-lang3:3.17.0'
implementation 'eu.chainfire:libsuperuser:1.1.1'
implementation 'moe.banana:toast-compat:1.0.5'
implementation 'org.lsposed.hiddenapibypass:hiddenapibypass:2.0'
implementation 'org.lsposed.hiddenapibypass:hiddenapibypass:3.0'
implementation group:'com.twofortyfouram', name:'android-plugin-api-for-locale', version:'[1.0.2,2.0['

coreLibraryDesugaring "com.android.tools:desugar_jdk_libs:2.1.2"
}
69 changes: 57 additions & 12 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.farmerbb.secondscreen"
android:installLocation="internalOnly" >

<uses-feature
Expand Down Expand Up @@ -49,6 +48,8 @@
<uses-permission-sdk-23 android:name="android.permission.SYSTEM_ALERT_WINDOW" />
<uses-permission-sdk-23 android:name="android.permission.WRITE_SECURE_SETTINGS"/>
<uses-permission-sdk-23 android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission-sdk-23 android:name="android.permission.FOREGROUND_SERVICE_SPECIAL_USE" />
<uses-permission-sdk-23 android:name="android.permission.POST_NOTIFICATIONS" />
<uses-permission-sdk-23 android:name="com.farmerbb.secondscreen.support.USE_SUPPORT_LIBRARY"/>

<uses-sdk
Expand Down Expand Up @@ -277,7 +278,11 @@

<service
android:name="com.farmerbb.secondscreen.service.BootService"
android:exported="true" >
android:exported="true"
android:foregroundServiceType="specialUse">
<property
android:name="android.app.PROPERTY_SPECIAL_USE_FGS_SUBTYPE"
android:value="This is a short-lived service that is required to be run in the foreground to accomplish its tasks"/>
</service>
<service
android:name="com.farmerbb.secondscreen.service.DisableKeyboardService"
Expand All @@ -292,43 +297,83 @@
</service>
<service
android:name="com.farmerbb.secondscreen.service.DisplayConnectionService"
android:exported="true" >
android:exported="true"
android:foregroundServiceType="specialUse">
<property
android:name="android.app.PROPERTY_SPECIAL_USE_FGS_SUBTYPE"
android:value="This foreground service is required for hosting broadcast receivers that listen to display connection events, which are hosted inside of a service instead of an activity"/>
</service>
<service
android:name="com.farmerbb.secondscreen.service.LockDeviceService"
android:exported="true" >
android:exported="true"
android:foregroundServiceType="specialUse">
<property
android:name="android.app.PROPERTY_SPECIAL_USE_FGS_SUBTYPE"
android:value="This is a short-lived service that is required to be run in the foreground to accomplish its tasks"/>
</service>
<service
android:name="com.farmerbb.secondscreen.service.NotificationService"
android:exported="true" >
android:exported="true"
android:foregroundServiceType="specialUse">
<property
android:name="android.app.PROPERTY_SPECIAL_USE_FGS_SUBTYPE"
android:value="This foreground service is required in order to access core functionality while the user is outside the app, via a notification with action buttons"/>
</service>
<service
android:name="com.farmerbb.secondscreen.service.ProfileLoadService"
android:exported="true" >
android:exported="true"
android:foregroundServiceType="specialUse">
<property
android:name="android.app.PROPERTY_SPECIAL_USE_FGS_SUBTYPE"
android:value="This is a short-lived service that is required to be run in the foreground to accomplish its tasks"/>
</service>
<service
android:name="com.farmerbb.secondscreen.service.SafeModeToggleService"
android:exported="true" >
android:exported="true"
android:foregroundServiceType="specialUse">
<property
android:name="android.app.PROPERTY_SPECIAL_USE_FGS_SUBTYPE"
android:value="This is a short-lived service that is required to be run in the foreground to accomplish its tasks"/>
</service>
<service
android:name="com.farmerbb.secondscreen.service.ScreenOnService"
android:exported="true" >
android:exported="true"
android:foregroundServiceType="specialUse">
<property
android:name="android.app.PROPERTY_SPECIAL_USE_FGS_SUBTYPE"
android:value="This is a short-lived service that is required to be run in the foreground to accomplish its tasks"/>
</service>
<service
android:name="com.farmerbb.secondscreen.service.TempBacklightOnService"
android:exported="true" >
android:exported="true"
android:foregroundServiceType="specialUse">
<property
android:name="android.app.PROPERTY_SPECIAL_USE_FGS_SUBTYPE"
android:value="This is a short-lived service that is required to be run in the foreground to accomplish its tasks"/>
</service>
<service
android:name="com.farmerbb.secondscreen.service.TestOverscanService"
android:exported="true" >
android:exported="true"
android:foregroundServiceType="specialUse">
<property
android:name="android.app.PROPERTY_SPECIAL_USE_FGS_SUBTYPE"
android:value="This is a short-lived service that is required to be run in the foreground to accomplish its tasks"/>
</service>
<service
android:name="com.farmerbb.secondscreen.service.TimeoutService"
android:exported="true" >
android:exported="true"
android:foregroundServiceType="specialUse">
<property
android:name="android.app.PROPERTY_SPECIAL_USE_FGS_SUBTYPE"
android:value="This is a short-lived service that is required to be run in the foreground to accomplish its tasks"/>
</service>
<service
android:name="com.farmerbb.secondscreen.service.TurnOffService"
android:exported="true" >
android:exported="true"
android:foregroundServiceType="specialUse">
<property
android:name="android.app.PROPERTY_SPECIAL_USE_FGS_SUBTYPE"
android:value="This is a short-lived service that is required to be run in the foreground to accomplish its tasks"/>
</service>

<provider
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

package com.farmerbb.secondscreen.activity;

import android.Manifest;
import android.annotation.SuppressLint;
import android.annotation.TargetApi;
import android.app.ActivityManager;
Expand Down Expand Up @@ -42,6 +43,7 @@
import android.os.Bundle;
import android.os.Handler;
import android.provider.Settings;
import androidx.annotation.NonNull;
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import androidx.appcompat.app.AppCompatActivity;
import android.view.Window;
Expand Down Expand Up @@ -306,7 +308,7 @@ protected void onCreate(Bundle savedInstanceState) {

// Determine if we need to show any dialogs before we create the fragments
if(savedInstanceState == null)
showDialogs();
showDialogs(false);

// Read debug mode preference
if(isDebugModeEnabled(false))
Expand Down Expand Up @@ -512,7 +514,7 @@ public void onFirstRunDialogPositiveClick() {
U.startService(this, serviceIntent);

// Determine if we need to show any dialogs before we create the fragments
showDialogs();
showDialogs(false);

// Set launcher shortcuts on API 25+
setLauncherShortcuts();
Expand Down Expand Up @@ -914,8 +916,12 @@ public void uninstallPackage(String packageName) {
finish();
}

private void showDialogs() {
if(Build.VERSION.SDK_INT < Build.VERSION_CODES.M || U.hasElevatedPermissions(this))
private void showDialogs(boolean hasPreviouslyRequestedPermission) {
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU
&& checkSelfPermission(Manifest.permission.POST_NOTIFICATIONS) != PackageManager.PERMISSION_GRANTED
&& !hasPreviouslyRequestedPermission) {
requestPermissions(new String[]{Manifest.permission.POST_NOTIFICATIONS}, 42);
} else if(Build.VERSION.SDK_INT < Build.VERSION_CODES.M || U.hasElevatedPermissions(this))
showMoreDialogs();
else
startActivity(new Intent(this, UnableToStartActivity.class));
Expand Down Expand Up @@ -1071,4 +1077,10 @@ public void onSystemAlertPermissionDialogNegativeClick() {
onFirstLoadPositiveClick(null, filename, false);
}
}

@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
showDialogs(true);
}
}
Loading

0 comments on commit d8e0b40

Please sign in to comment.