Log: Switch to android's log class everywhere

Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
This commit is contained in:
Aayush Gupta
2024-08-19 14:56:41 +05:30
parent 1542a282b0
commit e5d2c66405
27 changed files with 143 additions and 159 deletions

View File

@@ -32,6 +32,7 @@ import android.net.Uri
import android.os.Bundle
import android.os.Environment
import android.os.PowerManager
import android.util.Log
import android.util.TypedValue
import android.view.LayoutInflater
import androidx.browser.customtabs.CustomTabsIntent
@@ -41,9 +42,10 @@ import androidx.core.content.ContextCompat
import com.aurora.Constants
import com.aurora.gplayapi.data.models.App
import com.aurora.store.R
import com.aurora.store.util.Log
import com.aurora.store.util.Preferences
private const val TAG = "Context"
val Context.inflater: LayoutInflater
get() = LayoutInflater.from(this)
@@ -51,8 +53,8 @@ fun Context.browse(url: String) {
try {
val customTabsIntent = CustomTabsIntent.Builder()
customTabsIntent.build().launchUrl(this, Uri.parse(url))
} catch (e: Exception) {
Log.e(e.message)
} catch (exception: Exception) {
Log.e(TAG, "Failed to open custom tab", exception)
}
}
@@ -66,7 +68,7 @@ fun Context.share(app: App) {
}
startActivity(Intent.createChooser(sendIntent, getString(R.string.action_share)))
} catch (exception: Exception) {
Log.e("Failed to share app", exception)
Log.e(TAG, "Failed to share app", exception)
}
}
@@ -77,8 +79,8 @@ fun Context.openInfo(packageName: String) {
Uri.parse("package:$packageName")
)
startActivity(intent)
} catch (e: Exception) {
} catch (exception: Exception) {
Log.e(TAG, "Failed to open app info page", exception)
}
}

View File

@@ -2,10 +2,10 @@ package com.aurora.store.data.installer
import android.content.Context
import android.content.Intent
import android.util.Log
import com.aurora.store.R
import com.aurora.store.data.model.InstallerInfo
import com.aurora.store.data.room.download.Download
import com.aurora.store.util.Log
import com.aurora.store.util.PackageUtil.isSharedLibraryInstalled
import com.aurora.store.util.PathUtil
import dagger.hilt.android.qualifiers.ApplicationContext
@@ -34,11 +34,13 @@ class AMInstaller @Inject constructor(
}
}
private val TAG = AMInstaller::class.java.simpleName
override fun install(download: Download) {
if (isAlreadyQueued(download.packageName)) {
Log.i("${download.packageName} already queued")
Log.i(TAG, "${download.packageName} already queued")
} else {
Log.i("Received AM install request for ${download.packageName}")
Log.i(TAG, "Received AM install request for ${download.packageName}")
val fileList = mutableListOf<File>()
download.sharedLibs.forEach {

View File

@@ -21,12 +21,12 @@ package com.aurora.store.data.installer
import android.content.Context
import android.net.Uri
import android.util.Log
import androidx.core.content.FileProvider
import com.aurora.store.AuroraApp
import com.aurora.store.BuildConfig
import com.aurora.store.data.event.InstallerEvent
import com.aurora.store.data.room.download.Download
import com.aurora.store.util.Log
import com.aurora.store.util.PathUtil
import com.aurora.store.util.Preferences
import com.aurora.store.util.Preferences.PREFERENCE_AUTO_DELETE
@@ -34,6 +34,8 @@ import java.io.File
abstract class InstallerBase(protected var context: Context) : IInstaller {
private val TAG = InstallerBase::class.java.simpleName
var download: Download? = null
private set
@@ -64,7 +66,7 @@ abstract class InstallerBase(protected var context: Context) : IInstaller {
}
open fun postError(packageName: String, error: String?, extra: String?) {
Log.e("Service Error :$error")
Log.e(TAG, "Service Error :$error")
val event = InstallerEvent.Failed(packageName).apply {
this.error = error ?: ""

View File

@@ -23,11 +23,11 @@ import android.content.Context
import android.content.Intent
import android.net.Uri
import android.os.Build
import android.util.Log
import com.aurora.extensions.runOnUiThread
import com.aurora.store.R
import com.aurora.store.data.model.InstallerInfo
import com.aurora.store.data.room.download.Download
import com.aurora.store.util.Log
import dagger.hilt.android.qualifiers.ApplicationContext
import java.io.File
import javax.inject.Inject
@@ -51,11 +51,13 @@ class NativeInstaller @Inject constructor(
}
}
private val TAG = NativeInstaller::class.java.simpleName
override fun install(download: Download) {
if (isAlreadyQueued(download.packageName)) {
Log.i("${download.packageName} already queued")
Log.i(TAG, "${download.packageName} already queued")
} else {
Log.i("Received native install request for ${download.packageName}")
Log.i(TAG, "Received native install request for ${download.packageName}")
getFiles(download.packageName, download.versionCode).forEach { xInstall(it) }
}
}

View File

@@ -20,12 +20,12 @@
package com.aurora.store.data.installer
import android.content.Context
import android.util.Log
import com.aurora.store.AuroraApp
import com.aurora.store.R
import com.aurora.store.data.event.InstallerEvent
import com.aurora.store.data.model.InstallerInfo
import com.aurora.store.data.room.download.Download
import com.aurora.store.util.Log
import com.aurora.store.util.PackageUtil.isSharedLibraryInstalled
import com.topjohnwu.superuser.Shell
import dagger.hilt.android.qualifiers.ApplicationContext
@@ -50,9 +50,11 @@ class RootInstaller @Inject constructor(
}
}
private val TAG = RootInstaller::class.java.simpleName
override fun install(download: Download) {
if (isAlreadyQueued(download.packageName)) {
Log.i("${download.packageName} already queued")
Log.i(TAG, "${download.packageName} already queued")
} else {
if (Shell.getShell().isRoot) {
download.sharedLibs.forEach {
@@ -68,7 +70,7 @@ class RootInstaller @Inject constructor(
context.getString(R.string.installer_status_failure),
context.getString(R.string.installer_root_unavailable)
)
Log.e(" >>>>>>>>>>>>>>>>>>>>>>>>>> NO ROOT ACCESS <<<<<<<<<<<<<<<<<<<<<<<<<<<<<")
Log.e(TAG, " >>>>>>>>>>>>>>>>>>>>>>>>>> NO ROOT ACCESS <<<<<<<<<<<<<<<<<<<<<<<<<<<<<")
}
}
}

View File

@@ -29,6 +29,7 @@ import android.os.Handler
import android.os.IBinder
import android.os.Looper
import android.os.RemoteException
import android.util.Log
import androidx.core.content.FileProvider
import com.aurora.services.IPrivilegedCallback
import com.aurora.services.IPrivilegedService
@@ -38,7 +39,6 @@ import com.aurora.store.R
import com.aurora.store.data.event.InstallerEvent
import com.aurora.store.data.model.InstallerInfo
import com.aurora.store.data.room.download.Download
import com.aurora.store.util.Log
import com.aurora.store.util.PackageUtil
import dagger.hilt.android.qualifiers.ApplicationContext
import java.io.File
@@ -73,16 +73,18 @@ class ServiceInstaller @Inject constructor(
}
}
private val TAG = ServiceInstaller::class.java.simpleName
override fun install(download: Download) {
super.install(download)
when {
isAlreadyQueued(download.packageName) -> {
Log.i("${download.packageName} already queued")
Log.i(TAG, "${download.packageName} already queued")
}
PackageUtil.isInstalled(context, PRIVILEGED_EXTENSION_PACKAGE_NAME) -> {
Log.i("Received service install request for ${download.packageName}")
Log.i(TAG, "Received service install request for ${download.packageName}")
val fileList = getFiles(download.packageName, download.versionCode)
xInstall(
download.packageName,
@@ -118,7 +120,7 @@ class ServiceInstaller @Inject constructor(
val service = IPrivilegedService.Stub.asInterface(binder)
if (service.hasPrivilegedPermissions()) {
Log.i(context.getString(R.string.installer_service_available))
Log.i(TAG, context.getString(R.string.installer_service_available))
val callback = object : IPrivilegedCallback.Stub() {
@@ -192,7 +194,7 @@ class ServiceInstaller @Inject constructor(
override fun onServiceDisconnected(name: ComponentName) {
removeFromInstallQueue(packageName)
readyWithAction.set(true)
Log.e("Disconnected from Aurora Services")
Log.e(TAG, "Disconnected from Aurora Services")
}
}
@@ -208,12 +210,12 @@ class ServiceInstaller @Inject constructor(
while (!readyWithAction.get()) {
Thread.sleep(1000)
}
Log.i("Services Callback : install wait done")
Log.i(TAG, "Services Callback : install wait done")
}
}
private fun handleCallbackUninstall(packageName: String, returnCode: Int, extra: String?) {
Log.i("Services Callback : $packageName $returnCode $extra")
Log.i(TAG, "Services Callback : $packageName $returnCode $extra")
try {
when (returnCode) {
@@ -243,7 +245,7 @@ class ServiceInstaller @Inject constructor(
}
private fun handleCallback(packageName: String, returnCode: Int, extra: String?) {
Log.i("Services Callback : $packageName $returnCode $extra")
Log.i(TAG, "Services Callback : $packageName $returnCode $extra")
try {
when (returnCode) {

View File

@@ -29,6 +29,7 @@ import android.content.pm.PackageInstaller.PACKAGE_SOURCE_STORE
import android.content.pm.PackageInstaller.SessionParams
import android.content.pm.PackageManager
import android.os.Process
import android.util.Log
import androidx.core.app.PendingIntentCompat
import com.aurora.extensions.isNAndAbove
import com.aurora.extensions.isOAndAbove
@@ -47,7 +48,6 @@ import com.aurora.store.data.model.InstallerInfo
import com.aurora.store.data.model.SessionInfo
import com.aurora.store.data.receiver.InstallerStatusReceiver
import com.aurora.store.data.room.download.Download
import com.aurora.store.util.Log
import com.aurora.store.util.PackageUtil.isSharedLibraryInstalled
import dagger.hilt.android.qualifiers.ApplicationContext
import java.io.IOException
@@ -59,6 +59,8 @@ class SessionInstaller @Inject constructor(
@ApplicationContext context: Context
) : InstallerBase(context) {
private val TAG = SessionInstaller::class.java.simpleName
val currentSessionId: Int?
get() = enqueuedSessions.firstOrNull()?.last()?.sessionId
@@ -130,10 +132,10 @@ class SessionInstaller @Inject constructor(
val sessionSet =
enqueuedSessions.find { set -> set.any { it.packageName == download.packageName } }
if (sessionSet != null) {
Log.i("${download.packageName} already queued")
Log.i(TAG, "${download.packageName} already queued")
commitInstall(sessionSet.first())
} else {
Log.i("Received session install request for ${download.packageName}")
Log.i(TAG, "Received session install request for ${download.packageName}")
val sessionInfoSet = mutableSetOf<SessionInfo>()
download.sharedLibs.forEach {
@@ -178,7 +180,7 @@ class SessionInstaller @Inject constructor(
val session = packageInstaller.openSession(sessionId)
return try {
Log.i("Writing splits to session for $packageName")
Log.i(TAG, "Writing splits to session for $packageName")
getFiles(packageName, versionCode, sharedLibPkgName).forEach { file ->
file.inputStream().use { input ->
session.openWrite(
@@ -224,7 +226,7 @@ class SessionInstaller @Inject constructor(
}
private fun commitInstall(sessionInfo: SessionInfo) {
Log.i("Starting install session for ${sessionInfo.packageName}")
Log.i(TAG, "Starting install session for ${sessionInfo.packageName}")
val session = packageInstaller.openSession(sessionInfo.sessionId)
session.commit(getCallBackIntent(sessionInfo)!!.intentSender)
session.close()

View File

@@ -32,6 +32,7 @@ import android.content.pm.PackageManagerHidden
import android.os.Build
import android.os.IBinder
import android.os.IInterface
import android.util.Log
import androidx.annotation.RequiresApi
import androidx.core.app.PendingIntentCompat
import com.aurora.extensions.isOAndAbove
@@ -44,7 +45,6 @@ import com.aurora.store.data.installer.AppInstaller.Companion.EXTRA_VERSION_CODE
import com.aurora.store.data.model.InstallerInfo
import com.aurora.store.data.receiver.InstallerStatusReceiver
import com.aurora.store.data.room.download.Download
import com.aurora.store.util.Log
import com.aurora.store.util.PackageUtil.isSharedLibraryInstalled
import dagger.hilt.android.qualifiers.ApplicationContext
import dev.rikka.tools.refine.Refine
@@ -72,6 +72,8 @@ class ShizukuInstaller @Inject constructor(
}
}
private val TAG = ShizukuInstaller::class.java.simpleName
// Taken from LSPatch (https://github.com/LSPosed/LSPatch)
private fun IBinder.wrap() = ShizukuBinderWrapper(this)
private fun IInterface.asShizukuBinder() = this.asBinder().wrap()
@@ -100,7 +102,7 @@ class ShizukuInstaller @Inject constructor(
super.install(download)
if (isAlreadyQueued(download.packageName)) {
Log.i("${download.packageName} already queued")
Log.i(TAG, "${download.packageName} already queued")
} else {
download.sharedLibs.forEach {
// Shared library packages cannot be updated
@@ -126,7 +128,7 @@ class ShizukuInstaller @Inject constructor(
sharedLibPkgName: String = "",
displayName: String = ""
) {
Log.i("Received session install request for ${sharedLibPkgName.ifBlank { packageName }}")
Log.i(TAG, "Received session install request for ${sharedLibPkgName.ifBlank { packageName }}")
val (sessionId, session) = kotlin.runCatching {
val params = SessionParams(SessionParams.MODE_FULL_INSTALL)
@@ -158,7 +160,7 @@ class ShizukuInstaller @Inject constructor(
}
try {
Log.i("Writing splits to session for ${sharedLibPkgName.ifBlank { packageName }}")
Log.i(TAG, "Writing splits to session for ${sharedLibPkgName.ifBlank { packageName }}")
getFiles(packageName, versionCode, sharedLibPkgName).forEach {
it.inputStream().use { input ->
session.openWrite("${sharedLibPkgName.ifBlank { packageName }}_${System.currentTimeMillis()}", 0, -1).use { output ->
@@ -185,7 +187,7 @@ class ShizukuInstaller @Inject constructor(
true
)
Log.i("Starting install session for $packageName")
Log.i(TAG, "Starting install session for $packageName")
session.commit(pendingIntent!!.intentSender)
session.close()
} catch (exception: Exception) {

View File

@@ -20,12 +20,15 @@
package com.aurora.store.data.network
import android.content.Context
import android.util.Log
import com.aurora.store.data.model.ProxyInfo
import com.aurora.store.util.Log
import com.aurora.store.util.Preferences
import com.google.gson.Gson
object HttpClient {
private const val TAG = "HttpClient"
fun getPreferredClient(context: Context): IProxyHttpClient {
val proxyEnabled = Preferences.getBoolean(context, Preferences.PREFERENCE_PROXY_ENABLED)
val proxyInfoString = Preferences.getString(context, Preferences.PREFERENCE_PROXY_INFO)
@@ -36,11 +39,11 @@ object HttpClient {
if (proxyInfo != null) {
OkHttpClient.setProxy(proxyInfo)
} else {
Log.e("Proxy info is unavailable, using default client")
Log.e(TAG, "Proxy info is unavailable, using default client")
OkHttpClient
}
} else {
Log.i("Proxy is disabled")
Log.i(TAG, "Proxy is disabled")
OkHttpClient
}
}

View File

@@ -19,10 +19,10 @@
package com.aurora.store.data.network
import android.util.Log
import com.aurora.gplayapi.data.models.PlayResponse
import com.aurora.store.BuildConfig
import com.aurora.store.data.model.ProxyInfo
import com.aurora.store.util.Log
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.flow.asStateFlow
@@ -38,6 +38,8 @@ import java.util.concurrent.TimeUnit
object OkHttpClient : IProxyHttpClient {
private const val TAG = "OkHttpClient"
private const val POST = "POST"
private const val GET = "GET"
@@ -193,7 +195,7 @@ object OkHttpClient : IProxyHttpClient {
errorString = if (!response.isSuccessful) response.message else String()
).also {
_responseCode.value = response.code
Log.i("OKHTTP [${response.code}] ${response.request.url}")
Log.i(TAG, "OKHTTP [${response.code}] ${response.request.url}")
}
}
}

View File

@@ -20,6 +20,7 @@
package com.aurora.store.data.providers
import android.content.Context
import android.util.Log
import com.aurora.Constants
import com.aurora.Constants.ACCOUNT_SIGNED_IN
import com.aurora.gplayapi.data.models.AuthData
@@ -29,7 +30,6 @@ import com.aurora.store.R
import com.aurora.store.data.model.AccountType
import com.aurora.store.data.model.Auth
import com.aurora.store.data.network.HttpClient
import com.aurora.store.util.Log
import com.aurora.store.util.Preferences
import com.aurora.store.util.Preferences.PREFERENCE_AUTH_DATA
import com.aurora.store.util.Preferences.PREFERENCE_DISPENSER_URLS
@@ -49,6 +49,8 @@ class AuthProvider @Inject constructor(
private val gson: Gson
) {
private val TAG = AuthProvider::class.java.simpleName
private val spoofProvider: SpoofProvider get() = SpoofProvider(context)
val properties: Properties
get() {
@@ -111,7 +113,7 @@ class AuthProvider @Inject constructor(
}
private fun getSavedAuthData(): AuthData? {
Log.i("Loading saved AuthData")
Log.i(TAG, "Loading saved AuthData")
val rawAuth: String = Preferences.getString(context, PREFERENCE_AUTH_DATA)
return if (rawAuth.isNotEmpty()) {
gson.fromJson(rawAuth, AuthData::class.java)
@@ -134,7 +136,7 @@ class AuthProvider @Inject constructor(
locale = locale
)
} catch (exception: Exception) {
Log.e("Failed to generate Session", exception)
Log.e(TAG, "Failed to generate Session", exception)
return@withContext null
}
}
@@ -157,7 +159,7 @@ class AuthProvider @Inject constructor(
locale = locale
)
} catch (exception: Exception) {
Log.e("Failed to generate AuthData", exception)
Log.e(TAG, "Failed to generate AuthData", exception)
return@withContext null
}
}

View File

@@ -10,6 +10,7 @@ import android.net.Uri
import android.os.PowerManager
import android.provider.Settings
import android.provider.Settings.ACTION_APP_OPEN_BY_DEFAULT_SETTINGS
import android.util.Log
import androidx.activity.result.ActivityResult
import androidx.activity.result.ActivityResultCallback
import androidx.activity.result.ActivityResultLauncher
@@ -25,12 +26,14 @@ import com.aurora.store.BuildConfig
import com.aurora.store.PermissionCallback
import com.aurora.store.PermissionType
import com.aurora.store.R
import com.aurora.store.util.Log
import com.aurora.store.util.PackageUtil
import com.aurora.store.util.PathUtil
@SuppressLint("NewApi")
class PermissionProvider : ActivityResultCallback<ActivityResult> {
private val TAG = PermissionProvider::class.java.simpleName
private var context: Context
private var intentLauncher: ActivityResultLauncher<Intent>
private var permissionLauncher: ActivityResultLauncher<String>
@@ -109,10 +112,10 @@ class PermissionProvider : ActivityResultCallback<ActivityResult> {
}
}
}
} catch (e: ActivityNotFoundException) {
Log.e("PermissionProvider", "Activity not found for $permissionType: ${e.message}")
} catch (e: Exception) {
Log.e("PermissionProvider", "Error requesting permission: ${e.message}")
} catch (activityNotFoundException: ActivityNotFoundException) {
Log.e(TAG, "Activity not found for $permissionType", activityNotFoundException)
} catch (exception: Exception) {
Log.e(TAG, "Error requesting permission", exception)
}
}

View File

@@ -20,8 +20,8 @@
package com.aurora.store.data.providers
import android.content.Context
import android.util.Log
import com.aurora.store.BuildConfig
import com.aurora.store.util.Log
import com.aurora.store.util.PathUtil
import dagger.hilt.android.qualifiers.ApplicationContext
import java.io.BufferedInputStream
@@ -37,6 +37,8 @@ import javax.inject.Singleton
@Singleton
class SpoofDeviceProvider @Inject constructor(@ApplicationContext val context: Context) {
private val TAG = SpoofDeviceProvider::class.java.simpleName
private val SUFFIX = ".properties"
val availableDevice: List<Properties>
@@ -89,8 +91,8 @@ class SpoofDeviceProvider @Inject constructor(@ApplicationContext val context: C
try {
properties.load(jarFile.getInputStream(entry))
properties.setProperty("CONFIG_NAME", entry.name)
} catch (e: IOException) {
Log.e("Could not read %s", entry.name)
} catch (exception: IOException) {
Log.e(TAG, "Could not read ${entry.name}", exception)
}
return properties
}
@@ -100,8 +102,8 @@ class SpoofDeviceProvider @Inject constructor(@ApplicationContext val context: C
try {
properties.load(BufferedInputStream(FileInputStream(file)))
properties.setProperty("CONFIG_NAME", file.name)
} catch (e: IOException) {
Log.e("Could not read %s", file.name)
} catch (exception: IOException) {
Log.e(TAG, "Could not read ${file.name}", exception)
}
return properties
}
@@ -114,7 +116,7 @@ class SpoofDeviceProvider @Inject constructor(@ApplicationContext val context: C
return JarFile(file)
}
} catch (e: IOException) {
Log.e("Could not open Aurora Store apk as a jar file")
Log.e(TAG, "Could not open Aurora Store apk as a jar file")
}
return null
}

View File

@@ -20,6 +20,7 @@
package com.aurora.store.util
import android.content.Context
import android.util.Log
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.ProcessLifecycleOwner
import com.aurora.extensions.isSAndAbove
@@ -32,6 +33,8 @@ import kotlin.math.pow
object CommonUtil {
private const val TAG = "CommonUtil"
private val siPrefixes: Map<Int, String> = hashMapOf(
Pair(0, ""),
Pair(1, ""),
@@ -148,9 +151,9 @@ object CommonUtil {
try {
val sessionId = sessionInfo.sessionId
packageInstaller.abandonSession(sessionInfo.sessionId)
Log.i("Abandoned session id -> %d", sessionId)
} catch (e: Exception) {
Log.i(TAG, "Abandoned session id -> $sessionId")
} catch (exception: Exception) {
Log.e(TAG, "Failed to cleanup installation sessions")
}
}
}

View File

@@ -1,73 +0,0 @@
/*
* Aurora Store
* Copyright (C) 2021, Rahul Kumar Patel <whyorean@gmail.com>
*
* Aurora Store is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* Aurora Store is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Aurora Store. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.aurora.store.util
import android.content.Context
import android.util.Log
import java.io.File
import java.io.FileWriter
import java.io.IOException
object Log {
const val TAG = "¯\\_(ツ)_/¯ "
fun e(message: String?, vararg args: Any?) {
e(String.format(message!!, *args))
}
fun e(message: String?) {
Log.e(TAG, message!!)
}
fun i(message: String?, vararg args: Any?) {
i(String.format(message!!, *args))
}
fun i(message: String?) {
Log.i(TAG, message!!)
}
fun d(message: String?, vararg args: Any?) {
d(String.format(message!!, *args))
}
fun d(message: String?) {
Log.d(TAG, message!!)
}
fun w(message: String?, vararg args: Any?) {
w(String.format(message!!, *args))
}
fun w(message: String?) {
Log.w(TAG, message!!)
}
fun writeToFile(context: Context, obj: Any) {
try {
val out = FileWriter(File(context.filesDir, "AuroraLogs.txt"))
out.write(obj.toString())
out.close()
} catch (e: IOException) {
e(e.message)
}
}
}

View File

@@ -30,6 +30,7 @@ import android.graphics.Bitmap
import android.net.Uri
import android.os.Build
import android.provider.Settings
import android.util.Log
import androidx.annotation.RequiresApi
import androidx.core.content.pm.PackageInfoCompat
import androidx.core.graphics.drawable.toBitmap
@@ -42,6 +43,8 @@ import com.aurora.store.BuildConfig
object PackageUtil {
private const val TAG = "PackageUtil"
fun isInstalled(context: Context, packageName: String): Boolean {
return try {
getPackageInfo(context, packageName, PackageManager.GET_META_DATA)
@@ -191,7 +194,7 @@ object PackageUtil {
context.packageManager.defaultActivityIcon.toBitmap(96, 96)
}
} catch (exception: Exception) {
Log.e("Failed to get icon for package!", exception)
Log.e(TAG, "Failed to get icon for package!", exception)
null
}
}

View File

@@ -1,6 +1,7 @@
package com.aurora.store.util
import android.content.Context
import android.util.Log
import androidx.core.content.pm.ShortcutInfoCompat
import androidx.core.content.pm.ShortcutManagerCompat
import androidx.core.graphics.drawable.IconCompat

View File

@@ -19,11 +19,11 @@
package com.aurora.store.view.epoxy.groups
import android.util.Log
import com.airbnb.epoxy.EpoxyModel
import com.airbnb.epoxy.EpoxyModelGroup
import com.aurora.gplayapi.data.models.StreamCluster
import com.aurora.store.R
import com.aurora.store.util.Log
import com.aurora.store.view.epoxy.controller.GenericCarouselController
import com.aurora.store.view.epoxy.views.HeaderViewModel_
import com.aurora.store.view.epoxy.views.app.AppViewModel_
@@ -40,6 +40,8 @@ class CarouselModelGroup(
)
) {
companion object {
private const val TAG = "CarouselModelGroup"
private fun buildModels(
streamCluster: StreamCluster,
callbacks: GenericCarouselController.Callbacks
@@ -76,7 +78,7 @@ class CarouselModelGroup(
if (itemCount >= 2) {
if (position == clusterViewModels.count() - 2) {
callbacks.onClusterScrolled(streamCluster)
Log.i("Cluster %s Scrolled", streamCluster.clusterTitle)
Log.i(TAG, "Cluster ${streamCluster.clusterTitle} Scrolled")
}
}
}
@@ -99,4 +101,4 @@ class CarouselModelGroup(
return models
}
}
}
}

View File

@@ -19,11 +19,11 @@
package com.aurora.store.view.epoxy.groups
import android.util.Log
import com.airbnb.epoxy.EpoxyModel
import com.airbnb.epoxy.EpoxyModelGroup
import com.aurora.gplayapi.data.models.StreamCluster
import com.aurora.store.R
import com.aurora.store.util.Log
import com.aurora.store.view.epoxy.controller.GenericCarouselController
import com.aurora.store.view.epoxy.views.HeaderViewModel_
import com.aurora.store.view.epoxy.views.app.AppListViewModel_
@@ -41,6 +41,8 @@ class DeveloperModelGroup(
)
) {
companion object {
private const val TAG = "DeveloperModelGroup"
private fun buildModels(
streamCluster: StreamCluster,
callbacks: GenericCarouselController.Callbacks
@@ -98,7 +100,7 @@ class DeveloperModelGroup(
if (itemCount >= 2) {
if (position == clusterViewModels.count() - 2) {
callbacks.onClusterScrolled(streamCluster)
Log.i("Cluster %s Scrolled", streamCluster.clusterTitle)
Log.i(TAG, "Cluster ${streamCluster.clusterTitle} Scrolled")
}
}
}
@@ -123,4 +125,4 @@ class DeveloperModelGroup(
return models
}
}
}
}

View File

@@ -20,6 +20,7 @@
package com.aurora.store.view.ui.commons
import android.os.Bundle
import android.util.Log
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
@@ -32,12 +33,14 @@ import com.aurora.gplayapi.data.models.Category
import com.aurora.gplayapi.data.models.StreamCluster
import com.aurora.store.MobileNavigationDirections
import com.aurora.store.data.model.MinimalApp
import com.aurora.store.util.Log
import com.google.gson.Gson
import java.lang.reflect.ParameterizedType
import javax.inject.Inject
abstract class BaseFragment<ViewBindingType : ViewBinding> : Fragment() {
private val TAG = BaseFragment::class.java.simpleName
@Inject
lateinit var gson: Gson
@@ -127,7 +130,7 @@ abstract class BaseFragment<ViewBindingType : ViewBinding> : Fragment() {
recyclerView.swapAdapter(it, true)
}
}.onFailure {
Log.e("Failed to cleanup RecyclerView", it.message)
Log.e(TAG, "Failed to cleanup RecyclerView", it)
}
}
}

View File

@@ -21,6 +21,7 @@ package com.aurora.store.view.ui.preferences
import android.content.pm.PackageManager
import android.os.Bundle
import android.util.Log
import android.view.View
import androidx.navigation.fragment.findNavController
import com.aurora.extensions.isMIUI
@@ -30,7 +31,6 @@ import com.aurora.extensions.showDialog
import com.aurora.store.R
import com.aurora.store.data.installer.AppInstaller
import com.aurora.store.databinding.FragmentInstallerBinding
import com.aurora.store.util.Log
import com.aurora.store.util.Preferences
import com.aurora.store.util.Preferences.PREFERENCE_INSTALLER_ID
import com.aurora.store.util.save
@@ -43,15 +43,17 @@ import rikka.sui.Sui
@AndroidEntryPoint
class InstallerFragment : BaseFragment<FragmentInstallerBinding>() {
private val TAG = InstallerFragment::class.java.simpleName
private var installerId: Int = 0
private var shizukuAlive = Sui.isSui()
private val shizukuAliveListener = Shizuku.OnBinderReceivedListener {
Log.d("ShizukuInstaller Alive!")
Log.d(TAG, "ShizukuInstaller Alive!")
shizukuAlive = true
}
private val shizukuDeadListener = Shizuku.OnBinderDeadListener {
Log.d("ShizukuInstaller Dead!")
Log.d(TAG, "ShizukuInstaller Dead!")
shizukuAlive = false
}

View File

@@ -21,6 +21,7 @@ package com.aurora.store.viewmodel.browse
import android.annotation.SuppressLint
import android.content.Context
import android.util.Log
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
@@ -28,7 +29,6 @@ import com.aurora.gplayapi.data.models.StreamCluster
import com.aurora.gplayapi.helpers.ExpandedBrowseHelper
import com.aurora.store.data.network.HttpClient
import com.aurora.store.data.providers.AuthProvider
import com.aurora.store.util.Log
import dagger.hilt.android.lifecycle.HiltViewModel
import dagger.hilt.android.qualifiers.ApplicationContext
import kotlinx.coroutines.Dispatchers
@@ -43,6 +43,8 @@ class ExpandedStreamBrowseViewModel @Inject constructor(
private val authProvider: AuthProvider
) : ViewModel() {
private val TAG = ExpandedStreamBrowseViewModel::class.java.simpleName
private val streamHelper: ExpandedBrowseHelper = ExpandedBrowseHelper(authProvider.authData!!)
.using(HttpClient.getPreferredClient(context))
@@ -67,7 +69,7 @@ class ExpandedStreamBrowseViewModel @Inject constructor(
}
fun next() {
Log.e("NEXT CALED")
Log.e(TAG, "NEXT CALED")
viewModelScope.launch(Dispatchers.IO) {
supervisorScope {
try {
@@ -83,9 +85,10 @@ class ExpandedStreamBrowseViewModel @Inject constructor(
liveData.postValue(streamCluster)
if (!streamCluster.hasNext()) {
Log.i("End of Bundle")
Log.i(TAG, "End of Bundle")
}
} catch (e: Exception) {
} catch (exception: Exception) {
Log.e(TAG, "Failed to fetch next stream", exception)
}
}
}

View File

@@ -21,6 +21,7 @@ package com.aurora.store.viewmodel.browse
import android.annotation.SuppressLint
import android.content.Context
import android.util.Log
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
@@ -29,7 +30,6 @@ import com.aurora.gplayapi.helpers.contracts.StreamContract
import com.aurora.gplayapi.helpers.web.WebStreamHelper
import com.aurora.store.data.network.HttpClient
import com.aurora.store.data.providers.AuthProvider
import com.aurora.store.util.Log
import dagger.hilt.android.lifecycle.HiltViewModel
import dagger.hilt.android.qualifiers.ApplicationContext
import kotlinx.coroutines.Dispatchers
@@ -44,6 +44,8 @@ class StreamBrowseViewModel @Inject constructor(
private val authProvider: AuthProvider
) : ViewModel() {
private val TAG = StreamBrowseViewModel::class.java.simpleName
private val streamHelper: StreamContract = WebStreamHelper()
.using(HttpClient.getPreferredClient(context))
@@ -72,7 +74,7 @@ class StreamBrowseViewModel @Inject constructor(
liveData.postValue(streamCluster)
} else {
Log.i("End of Cluster")
Log.i(TAG, "End of Cluster")
}
} catch (_: Exception) {
}

View File

@@ -20,6 +20,7 @@
package com.aurora.store.viewmodel.details
import android.content.Context
import android.util.Log
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
@@ -32,7 +33,6 @@ import com.aurora.store.AppStreamStash
import com.aurora.store.data.model.ViewState
import com.aurora.store.data.network.HttpClient
import com.aurora.store.data.providers.AuthProvider
import com.aurora.store.util.Log
import dagger.hilt.android.lifecycle.HiltViewModel
import dagger.hilt.android.qualifiers.ApplicationContext
import kotlinx.coroutines.Dispatchers
@@ -46,6 +46,8 @@ class DetailsClusterViewModel @Inject constructor(
authProvider: AuthProvider
) : ViewModel() {
private val TAG = DetailsClusterViewModel::class.java.simpleName
private var appDetailsHelper = AppDetailsHelper(authProvider.authData!!)
.using(HttpClient.getPreferredClient(context))
private var streamHelper = StreamHelper(authProvider.authData!!)
@@ -93,7 +95,7 @@ class DetailsClusterViewModel @Inject constructor(
updateCluster(url, streamCluster.id, newCluster)
liveData.postValue(ViewState.Success(stash))
} else {
Log.i("End of cluster")
Log.i(TAG, "End of cluster")
streamCluster.clusterNextPageUrl = String()
}
} catch (e: Exception) {

View File

@@ -21,6 +21,7 @@ package com.aurora.store.viewmodel.details
import android.annotation.SuppressLint
import android.content.Context
import android.util.Log
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
@@ -33,7 +34,6 @@ import com.aurora.gplayapi.helpers.contracts.StreamContract
import com.aurora.store.data.model.ViewState
import com.aurora.store.data.network.HttpClient
import com.aurora.store.data.providers.AuthProvider
import com.aurora.store.util.Log
import dagger.hilt.android.lifecycle.HiltViewModel
import dagger.hilt.android.qualifiers.ApplicationContext
import kotlinx.coroutines.Dispatchers
@@ -48,6 +48,8 @@ class DevProfileViewModel @Inject constructor(
private val authProvider: AuthProvider
) : ViewModel() {
private val TAG = DevProfileViewModel::class.java.simpleName
private var appDetailsHelper = AppDetailsHelper(authProvider.authData!!)
.using(HttpClient.getPreferredClient(context))
private var streamHelper = StreamHelper(authProvider.authData!!)
@@ -83,7 +85,7 @@ class DevProfileViewModel @Inject constructor(
devStream = devStream.copy(streamBundle = streamBundle)
liveData.postValue(ViewState.Success(devStream))
} else {
Log.i("End of cluster")
Log.i(TAG, "End of cluster")
streamCluster.clusterNextPageUrl = String()
}
} catch (e: Exception) {

View File

@@ -21,6 +21,7 @@ package com.aurora.store.viewmodel.homestream
import android.annotation.SuppressLint
import android.content.Context
import android.util.Log
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
@@ -31,7 +32,6 @@ import com.aurora.gplayapi.helpers.web.WebStreamHelper
import com.aurora.store.HomeStash
import com.aurora.store.data.model.ViewState
import com.aurora.store.data.network.HttpClient
import com.aurora.store.util.Log
import dagger.hilt.android.lifecycle.HiltViewModel
import dagger.hilt.android.qualifiers.ApplicationContext
import kotlinx.coroutines.Dispatchers
@@ -45,6 +45,8 @@ class StreamViewModel @Inject constructor(
@ApplicationContext private val context: Context
) : ViewModel() {
private val TAG = StreamViewModel::class.java.simpleName
private var webStreamHelper = WebStreamHelper()
.using(HttpClient.getPreferredClient(context))
@@ -91,7 +93,7 @@ class StreamViewModel @Inject constructor(
//Post updated to UI
liveData.postValue(ViewState.Success(stash))
} else {
Log.i("End of Bundle")
Log.i(TAG, "End of Bundle")
}
} catch (e: Exception) {
liveData.postValue(ViewState.Error(e.message))
@@ -110,7 +112,7 @@ class StreamViewModel @Inject constructor(
updateCluster(category, streamCluster.id, newCluster)
liveData.postValue(ViewState.Success(stash))
} else {
Log.i("End of cluster")
Log.i(TAG, "End of cluster")
streamCluster.clusterNextPageUrl = String()
}
} catch (e: Exception) {

View File

@@ -21,6 +21,7 @@ package com.aurora.store.viewmodel.subcategory
import android.annotation.SuppressLint
import android.content.Context
import android.util.Log
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
@@ -31,7 +32,6 @@ import com.aurora.gplayapi.helpers.contracts.StreamContract
import com.aurora.gplayapi.helpers.web.WebCategoryStreamHelper
import com.aurora.store.data.model.ViewState
import com.aurora.store.data.network.HttpClient
import com.aurora.store.util.Log
import dagger.hilt.android.lifecycle.HiltViewModel
import dagger.hilt.android.qualifiers.ApplicationContext
import kotlinx.coroutines.Dispatchers
@@ -45,6 +45,8 @@ class CategoryStreamViewModel @Inject constructor(
@ApplicationContext private val context: Context
) : ViewModel() {
private val TAG = CategoryStreamViewModel::class.java.simpleName
private var webCategoryStreamHelper = WebCategoryStreamHelper()
.using(HttpClient.getPreferredClient(context))
@@ -92,7 +94,7 @@ class CategoryStreamViewModel @Inject constructor(
//Post updated to UI
liveData.postValue(ViewState.Success(stash))
} else {
Log.i("End of Bundle")
Log.i(TAG, "End of Bundle")
}
} catch (e: Exception) {
liveData.postValue(ViewState.Error(e.message))
@@ -111,7 +113,7 @@ class CategoryStreamViewModel @Inject constructor(
updateCluster(category, streamCluster.id, newCluster)
liveData.postValue(ViewState.Success(stash))
} else {
Log.i("End of cluster")
Log.i(TAG, "End of cluster")
streamCluster.clusterNextPageUrl = String()
}
} catch (e: Exception) {