Skip to content

Commit

Permalink
Merge pull request #504 from KieronQuinn/release/1.3
Browse files Browse the repository at this point in the history
1.3
  • Loading branch information
KieronQuinn authored Mar 25, 2022
2 parents 7e848b1 + ed07abe commit c271541
Show file tree
Hide file tree
Showing 55 changed files with 1,022 additions and 190 deletions.
5 changes: 5 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 8 additions & 8 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ plugins {
//Permission for Columbus to use
rootProject.ext.set("columbusPermission", "com.google.android.columbus.taptap.permission.CONFIGURE_COLUMBUS_GESTURE")

def tagName = '1.2'
def tagName = '1.3'

android {
compileSdk 32
Expand All @@ -21,7 +21,7 @@ android {
applicationId "com.kieronquinn.app.taptap"
minSdk 24
targetSdk 32
versionCode 1200
versionCode 1300
versionName tagName

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
Expand Down Expand Up @@ -87,13 +87,13 @@ dependencies {
implementation 'com.google.android.gms:play-services-oss-licenses:17.0.0'

//Room
def room_version = "2.4.1"
def room_version = "2.4.2"
implementation "androidx.room:room-runtime:$room_version"
implementation "androidx.room:room-ktx:$room_version"
kapt "androidx.room:room-compiler:$room_version"

//MD3
implementation 'com.google.android.material:material:1.6.0-alpha02'
implementation 'com.google.android.material:material:1.6.0-beta01'

//MonetCompat for Monet backwards compatibility
implementation 'com.github.KieronQuinn:MonetCompat:0.4.1'
Expand All @@ -112,7 +112,7 @@ dependencies {
implementation "com.squareup.retrofit2:converter-gson:2.9.0"

//Gson for serialization
implementation 'com.google.code.gson:gson:2.8.9'
implementation 'com.google.code.gson:gson:2.9.0'

//Columbus module is separate to make it easier to work with
implementation project(path: ':columbus')
Expand All @@ -127,7 +127,7 @@ dependencies {
compileOnly project(path: ':systemstubs')

//Bypass hidden API requirements for Shizuku + more
implementation 'org.lsposed.hiddenapibypass:hiddenapibypass:4.2'
implementation 'org.lsposed.hiddenapibypass:hiddenapibypass:4.3'

//Tasker library to fire events
implementation 'com.joaomgcd:taskerpluginlibrary:0.4.2'
Expand All @@ -138,7 +138,7 @@ dependencies {
implementation "dev.rikka.shizuku:provider:$shizuku_version"
implementation "dev.rikka.tools.refine:runtime:$refine_version"

def libsuVersion = '3.2.1'
def libsuVersion = '4.0.0'
implementation "com.github.topjohnwu.libsu:core:${libsuVersion}"
implementation "com.github.topjohnwu.libsu:service:${libsuVersion}"

Expand All @@ -155,7 +155,7 @@ dependencies {
implementation "io.noties.markwon:core:4.6.2"

//Lottie for animations
implementation 'com.airbnb.android:lottie:4.2.2'
implementation 'com.airbnb.android:lottie:5.0.3'

//Process Phoenix to fully restart the app when needed
implementation 'com.jakewharton:process-phoenix:2.1.2'
Expand Down
6 changes: 5 additions & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.CAMERA"/>
<uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
<uses-permission android:name="android.permission.QUERY_ALL_PACKAGES"/>
<uses-permission android:name="android.permission.QUERY_ALL_PACKAGES"
tools:ignore="QueryAllPackagesPermission" />
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
<uses-permission android:name="android.permission.ACCESS_NOTIFICATION_POLICY"/>
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
Expand All @@ -18,6 +19,8 @@
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES"/>
<uses-permission android:name="net.dinglisch.android.tasker.PERMISSION_RUN_TASKS" />
<uses-permission android:name="com.android.alarm.permission.SET_ALARM"/>
<uses-permission android:name="android.permission.READ_LOGS"
tools:ignore="ProtectedPermissions" />
<uses-permission android:name="android.permission.HIGH_SAMPLING_RATE_SENSORS"
tools:ignore="HighSamplingRate" />

Expand All @@ -36,6 +39,7 @@
<activity
android:name=".ui.activities.MainActivity"
android:screenOrientation="portrait"
android:launchMode="singleInstance"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import com.kieronquinn.app.taptap.models.service.ActivityContainer;
interface ITapTapRootService {
SnapchatQuickTapState isSnapchatQuickTapToSnapEnabled();
void applySnapchatOverride();
void grantReadLogsPermission();

int startActivityPrivileged(in ActivityContainer activityContainer, in Intent intent);
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import com.kieronquinn.app.taptap.contexthub.IRemoteContextHubClient;
interface ITapTapShizukuService {

IRemoteContextHubClient getRemoteContextHubClient() = 1;
void grantReadLogsPermission() = 2;

void destroy() = 16777114;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ interface ITapTapShizukuShellService {

void clickQuickSetting(String component) = 5;

void grantReadLogsPermission() = 6;

void destroy() = 16777114;

}
79 changes: 48 additions & 31 deletions app/src/main/java/com/kieronquinn/app/taptap/TapTap.kt
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.kieronquinn.app.taptap

import android.app.Application
import android.app.IActivityManager
import android.os.Build
import android.os.Handler
import android.os.Looper
Expand All @@ -18,10 +17,7 @@ import com.kieronquinn.app.taptap.components.blur.BlurProvider
import com.kieronquinn.app.taptap.components.columbus.ColumbusServiceSettings
import com.kieronquinn.app.taptap.components.columbus.TapTapColumbusService
import com.kieronquinn.app.taptap.components.columbus.adjustments.SensitivityAdjustment
import com.kieronquinn.app.taptap.components.columbus.sensors.ServiceEventEmitter
import com.kieronquinn.app.taptap.components.columbus.sensors.ServiceEventEmitterImpl
import com.kieronquinn.app.taptap.components.columbus.sensors.TapTapCHREGestureSensor
import com.kieronquinn.app.taptap.components.columbus.sensors.TapTapGestureSensorImpl
import com.kieronquinn.app.taptap.components.columbus.sensors.*
import com.kieronquinn.app.taptap.components.navigation.*
import com.kieronquinn.app.taptap.components.service.TapTapServiceRouter
import com.kieronquinn.app.taptap.components.service.TapTapServiceRouterImpl
Expand Down Expand Up @@ -115,6 +111,8 @@ import com.kieronquinn.app.taptap.ui.screens.settings.modelpicker.SettingsModelP
import com.kieronquinn.app.taptap.ui.screens.settings.modelpicker.SettingsModelPickerViewModelImpl
import com.kieronquinn.app.taptap.ui.screens.settings.more.SettingsMoreViewModel
import com.kieronquinn.app.taptap.ui.screens.settings.more.SettingsMoreViewModelImpl
import com.kieronquinn.app.taptap.ui.screens.settings.nativemode.SettingsNativeModeViewModel
import com.kieronquinn.app.taptap.ui.screens.settings.nativemode.SettingsNativeModeViewModelImpl
import com.kieronquinn.app.taptap.ui.screens.settings.options.SettingsOptionsViewModel
import com.kieronquinn.app.taptap.ui.screens.settings.options.SettingsOptionsViewModelImpl
import com.kieronquinn.app.taptap.ui.screens.settings.shared.internet.SettingsSharedInternetPermissionDialogViewModel
Expand Down Expand Up @@ -166,7 +164,6 @@ import org.koin.core.context.startKoin
import org.koin.core.scope.Scope
import org.koin.dsl.module
import org.lsposed.hiddenapibypass.HiddenApiBypass
import rikka.shizuku.SystemServiceHelper

class TapTap : Application() {

Expand All @@ -178,7 +175,7 @@ class TapTap : Application() {
single { BlurProvider.getBlurProvider(resources) }
single { Gson() }
single { createMarkwon() }
single<TapTapSettings> { TapTapSettingsImpl(get()) }
single<TapTapSettings> { TapTapSettingsImpl(get(), get()) }
single<TapTapAccessibilityRouter> { TapTapAccessibilityRouterImpl() }
single<TapTapServiceRouter> { TapTapServiceRouterImpl() }
single<SuiProvider>(createdAtStart = true) { SuiProviderImpl() }
Expand Down Expand Up @@ -247,6 +244,7 @@ class TapTap : Application() {
viewModel<SetupCompleteViewModel> { SetupCompleteViewModelImpl(get(), get()) }
viewModel<SetupUpgradeViewModel> { SetupUpgradeViewModelImpl(get(), get()) }
viewModel<DisableColumbusViewModel> { DisableColumbusViewModelImpl(get(), get()) }
viewModel<SettingsNativeModeViewModel> { SettingsNativeModeViewModelImpl(get(), get(), get()) }
}

private val navigationModule = module {
Expand Down Expand Up @@ -282,6 +280,12 @@ class TapTap : Application() {
}
}

private val nativeModeModule = module {
scope<SettingsNativeModeViewModelImpl> {
scoped<TapTapShizukuServiceRepository> { TapTapShizukuServiceRepositoryImpl(get(), this, false) }
}
}

private fun Scope.createGestureSensor(): GestureSensor {
val columbusInitializer = get<ColumbusServiceSettings>()
val demoModeRepository = get<DemoModeRepository>()
Expand All @@ -291,29 +295,42 @@ class TapTap : Application() {
val useContextHub = if(demoModeRepository.isDemoModeEnabled()){
demoModeRepository.getUseContextHub()
}else columbusInitializer.useContextHub
return if (useContextHub) {
TapTapCHREGestureSensor(
get(),
columbusInitializer.lifecycleOwner,
get(),
get(),
get(),
get(),
get(),
mainHandler,
get(),
isTripleTapEnabled
)
} else {
TapTapGestureSensorImpl(
this@TapTap,
mainHandler,
isTripleTapEnabled,
get(),
this,
columbusInitializer.tapModel,
get()
)
val useContextHubLogging = if(demoModeRepository.isDemoModeEnabled()){
demoModeRepository.getUseContextHub()
}else columbusInitializer.useContextHubLogging
return when {
useContextHub -> {
TapTapCHREGestureSensor(
get(),
columbusInitializer.lifecycleOwner,
get(),
get(),
get(),
get(),
get(),
mainHandler,
get(),
isTripleTapEnabled
)
}
useContextHubLogging -> {
TapTapCHRELogSensor(
this,
columbusInitializer.isTripleTapEnabled,
get()
)
}
else -> {
TapTapGestureSensorImpl(
this@TapTap,
mainHandler,
isTripleTapEnabled,
get(),
this,
columbusInitializer.tapModel,
get()
)
}
}
}

Expand Down Expand Up @@ -370,7 +387,7 @@ class TapTap : Application() {
)
startKoin {
androidContext(this@TapTap)
modules(singlesModule, repositoriesModule, navigationModule, viewModelModule, appShortcutsModule, columbusModule)
modules(singlesModule, repositoriesModule, navigationModule, viewModelModule, appShortcutsModule, nativeModeModule, columbusModule)
}
setupCrashReporting()
setupMonet()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ data class ColumbusServiceSettings (
private var _feedbackEffects: List<TapTapFeedbackEffect>? = null,
private var _isTripleTapEnabled: Boolean? = null,
private var _useContextHub: Boolean? = null,
private var _useContextHubLogging: Boolean? = null,
private var _tapModel: TapModel? = null
): KoinComponent {

Expand All @@ -42,6 +43,9 @@ data class ColumbusServiceSettings (
val useContextHub
get() = _useContextHub ?: throw NullPointerException("useContextHub not set in ColumbusServiceSettings")

val useContextHubLogging
get() = _useContextHubLogging ?: throw NullPointerException("useContextHubLogging not set in ColumbusServiceSettings")

val tapModel
get() = _tapModel ?: throw NullPointerException("tapModel not set in ColumbusServiceSettings")

Expand Down Expand Up @@ -73,6 +77,10 @@ data class ColumbusServiceSettings (
this._useContextHub = enabled
}

fun setUseContextHubLogging(enabled: Boolean) {
this._useContextHubLogging = enabled
}

fun setTapModel(tapModel: TapModel) {
this._tapModel = tapModel
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@ import android.content.ActivityNotFoundException
import android.content.ComponentName
import android.content.Context
import android.content.Intent
import android.provider.MediaStore
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.lifecycleScope
import com.google.android.columbus.feedback.FeedbackEffect
import com.google.android.columbus.sensors.GestureSensor
import com.kieronquinn.app.taptap.components.accessibility.TapTapAccessibilityRouter
import com.kieronquinn.app.taptap.components.columbus.actions.TapTapAction
import com.kieronquinn.app.taptap.components.columbus.gates.TapTapWhenGate
import com.kieronquinn.app.taptap.utils.extensions.EXTRA_KEY_IS_FROM_COLUMBUS
import com.kieronquinn.app.taptap.utils.extensions.isAppLaunchable
import kotlinx.coroutines.flow.*
import org.koin.core.component.inject
Expand All @@ -27,7 +29,6 @@ class SnapchatAction(

companion object {
const val PACKAGE_NAME = "com.snapchat.android"
val LAUNCH_COMPONENT = ComponentName("com.snapchat.android", "com.snap.samples.catalina.CatalinaActivity")
}

override val tag = "SnapchatAction"
Expand Down Expand Up @@ -63,8 +64,9 @@ class SnapchatAction(
if(showOverlayNotificationIfNeeded()) return
if(keyguardManager.isKeyguardLocked) {
try {
context.startActivity(Intent().apply {
component = LAUNCH_COMPONENT
context.startActivity(Intent(MediaStore.INTENT_ACTION_STILL_IMAGE_CAMERA_SECURE).apply {
`package` = PACKAGE_NAME
putExtra(EXTRA_KEY_IS_FROM_COLUMBUS, true)
addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
})
} catch (e: ActivityNotFoundException) {
Expand Down
Loading

0 comments on commit c271541

Please sign in to comment.