Skip to content

Commit

Permalink
Upgrade AGP, and dependencies, and update compile SDK to 34.
Browse files Browse the repository at this point in the history
  • Loading branch information
darshanparajuli committed Nov 25, 2023
1 parent fd73132 commit c41bbaf
Show file tree
Hide file tree
Showing 16 changed files with 128 additions and 124 deletions.
23 changes: 11 additions & 12 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,25 +1,27 @@
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-parcelize'
apply plugin: 'kotlin-kapt'

def fileProvider = "file_provider"

android {
compileSdkVersion 33
buildToolsVersion "33.0.1"

defaultConfig {
applicationId "com.dp.logcatapp"
minSdkVersion 16
targetSdkVersion 33
compileSdk 34
targetSdkVersion 34
versionCode 33
versionName "1.7.2"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
multiDexEnabled true
}

buildFeatures {
viewBinding true
}

signingConfigs {
release {
try {
Expand All @@ -35,22 +37,18 @@ android {
}
}

dexOptions {
javaMaxHeapSize "2g"
}

lintOptions {
abortOnError false
disable 'MissingTranslation'
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}

kotlinOptions {
jvmTarget = JavaVersion.VERSION_1_8
jvmTarget = JavaVersion.VERSION_17
}

buildTypes {
Expand All @@ -65,6 +63,7 @@ android {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
namespace 'com.dp.logcatapp'
}

dependencies {
Expand Down
134 changes: 66 additions & 68 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,104 +1,102 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.dp.logcatapp">
xmlns:tools="http://schemas.android.com/tools">

<!-- adb shell pm grant com.dp.logcatapp android.permission.READ_LOGS -->
<uses-permission android:name="android.permission.READ_LOGS"/>

<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_SPECIAL_USE" />
<uses-permission android:name="android.permission.READ_LOGS" />

<application
android:name=".LogcatApp"
android:allowBackup="true"
android:fullBackupContent="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:largeHeap="true"
android:supportsRtl="true"
android:theme="@style/LightTheme"
tools:ignore="GoogleAppIndexingWarning">
android:name=".LogcatApp"
android:allowBackup="true"
android:fullBackupContent="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:largeHeap="true"
android:supportsRtl="true"
android:theme="@style/LightTheme"
tools:ignore="GoogleAppIndexingWarning">
<activity
android:exported="true"
android:name=".activities.SplashActivity"
android:theme="@style/SplashScreenTheme">
android:name=".activities.SplashActivity"
android:exported="true"
android:theme="@style/SplashScreenTheme">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER"/>
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".activities.MainActivity"
android:launchMode="singleTask"/>
android:name=".activities.MainActivity"
android:launchMode="singleTask" />
<activity
android:name=".activities.SettingsActivity"
android:launchMode="singleTask"
android:parentActivityName=".activities.MainActivity"
android:windowSoftInputMode="adjustResize">
android:name=".activities.SettingsActivity"
android:launchMode="singleTask"
android:parentActivityName=".activities.MainActivity"
android:windowSoftInputMode="adjustResize">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".activities.MainActivity"/>
android:name="android.support.PARENT_ACTIVITY"
android:value=".activities.MainActivity" />
</activity>

<activity
android:name=".activities.FiltersActivity"
android:launchMode="singleTask"
android:parentActivityName=".activities.MainActivity"
android:windowSoftInputMode="adjustResize">
android:name=".activities.FiltersActivity"
android:launchMode="singleTask"
android:parentActivityName=".activities.MainActivity"
android:windowSoftInputMode="adjustResize">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".activities.MainActivity"/>
android:name="android.support.PARENT_ACTIVITY"
android:value=".activities.MainActivity" />
</activity>

<activity
android:name=".activities.SavedLogsActivity"
android:launchMode="singleTask"
android:parentActivityName=".activities.MainActivity"
android:windowSoftInputMode="adjustResize">
android:name=".activities.SavedLogsActivity"
android:launchMode="singleTask"
android:parentActivityName=".activities.MainActivity"
android:windowSoftInputMode="adjustResize">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".activities.MainActivity"/>
android:name="android.support.PARENT_ACTIVITY"
android:value=".activities.MainActivity" />
</activity>

<activity
android:name=".activities.SavedLogsViewerActivity"
android:launchMode="singleTask"
android:parentActivityName=".activities.SavedLogsActivity"
android:windowSoftInputMode="adjustResize"
android:exported="true">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".activities.SavedLogsActivity"/>
android:name=".activities.SavedLogsViewerActivity"
android:exported="true"
android:launchMode="singleTask"
android:parentActivityName=".activities.SavedLogsActivity"
android:windowSoftInputMode="adjustResize">
<intent-filter>
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT"/>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />

<data
android:mimeType="text/plain"
android:scheme="file"/>
android:mimeType="text/plain"
android:scheme="file" />
<data
android:mimeType="text/plain"
android:scheme="content"/>
android:mimeType="text/plain"
android:scheme="content" />
</intent-filter>
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".activities.SavedLogsActivity" />
</activity>

<service
android:name=".services.LogcatService"
android:exported="false"
android:stopWithTask="false"/>

<provider
android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}.${fileProvider}"
android:exported="false"
android:grantUriPermissions="true">
android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}.${fileProvider}"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/file_provider_paths"/>
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/file_provider_paths" />
</provider>
</application>

<service
android:name=".services.LogcatService"
android:exported="false"
android:foregroundServiceType="specialUse"
android:stopWithTask="false" />
</application>
</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ import kotlinx.coroutines.withContext

class LogcatLiveFragment : BaseFragment(), ServiceConnection, LogsReceivedListener {
companion object {
val TAG = LogcatLiveFragment::class.qualifiedName
val TAG = LogcatLiveFragment::class.qualifiedName!!
const val LOGCAT_DIR = "logcat"

private const val SEARCH_FILTER_TAG = "search_filter_tag"
Expand Down Expand Up @@ -297,7 +297,7 @@ class LogcatLiveFragment : BaseFragment(), ServiceConnection, LogsReceivedListen
}
}

viewModel.getFilters().observe(viewLifecycleOwner, Observer { filters ->
viewModel.getFilters().observe(viewLifecycleOwner) { filters ->
if (filters != null) {
logcatService?.let {
val logcat = it.logcat
Expand All @@ -319,13 +319,14 @@ class LogcatLiveFragment : BaseFragment(), ServiceConnection, LogsReceivedListen
}
}

Logger.debug(TAG, "setting filtered logs")
adapter.setItems(logcat.getLogsFiltered())
updateToolbarSubtitle(adapter.itemCount)
scrollRecyclerView()
resumeLogcat()
}
}
})
}
}

override fun onActivityCreated(savedInstanceState: Bundle?) {
Expand Down Expand Up @@ -657,6 +658,7 @@ class LogcatLiveFragment : BaseFragment(), ServiceConnection, LogsReceivedListen
}

override fun onReceivedLogs(logs: List<Log>) {
Logger.debug(TAG, "received logs")
adapter.addItems(logs)
updateToolbarSubtitle(adapter.itemCount)
if (viewModel.autoScroll) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import com.logcat.collections.FixedCircularArray

internal class MyRecyclerViewAdapter(
context: Context,
initialCapacity: Int
initialCapacity: Int,
) :
RecyclerView.Adapter<MyRecyclerViewAdapter.MyViewHolder>(),
View.OnClickListener,
Expand Down Expand Up @@ -50,7 +50,7 @@ internal class MyRecyclerViewAdapter(

override fun onBindViewHolder(
holder: MyViewHolder,
position: Int
position: Int,
) {
val log = list[position]
holder.date.text = log.date
Expand All @@ -66,7 +66,7 @@ internal class MyRecyclerViewAdapter(

override fun onCreateViewHolder(
parent: ViewGroup,
viewType: Int
viewType: Int,
): MyViewHolder {
val view = LayoutInflater.from(parent.context)
.inflate(R.layout.fragment_logcat_live_list_item, parent, false)
Expand Down Expand Up @@ -115,7 +115,7 @@ internal class MyRecyclerViewAdapter(

override fun onSharedPreferenceChanged(
sharedPreferences: SharedPreferences,
key: String
key: String?,
) {
when (key) {
PreferenceKeys.Logcat.KEY_MAX_LOGS -> {
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/com/dp/logcatapp/services/BaseService.kt
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ abstract class BaseService : LifecycleService(),

override fun onSharedPreferenceChanged(
sharedPreferences: SharedPreferences,
key: String
key: String?
) {
}

Expand Down
3 changes: 2 additions & 1 deletion app/src/main/java/com/dp/logcatapp/services/LogcatService.kt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import android.app.PendingIntent.FLAG_UPDATE_CURRENT
import android.content.Context
import android.content.Intent
import android.content.SharedPreferences
import android.content.pm.ServiceInfo
import android.graphics.BitmapFactory
import android.os.Build.VERSION
import android.os.Build.VERSION_CODES
Expand Down Expand Up @@ -187,7 +188,7 @@ class LogcatService : BaseService() {

override fun onSharedPreferenceChanged(
sharedPreferences: SharedPreferences,
key: String
key: String?
) {
super.onSharedPreferenceChanged(sharedPreferences, key)
when (key) {
Expand Down
26 changes: 13 additions & 13 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
ext.kotlin_version = '1.7.20'
ext.kotlin_version = '1.9.10'
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.3.1'
classpath 'com.android.tools.build:gradle:8.1.4'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"

// NOTE: Do not place your application dependencies here; they belong
Expand All @@ -23,25 +23,25 @@ allprojects {
}

ext {
appcompat_version = "1.5.1"
appcompat_version = "1.6.1"
constraint_layout_version = "2.1.4"
core_ktx_version = "1.9.0"
core_ktx_version = "1.12.0"
documentfile_version = "1.0.1"
fragment_ktx_version = "1.5.5"
kotlin_coroutines_android_version = "1.5.2"
kotlin_coroutines_core_version = "1.5.2"
fragment_ktx_version = "1.6.2"
kotlin_coroutines_android_version = "1.7.1"
kotlin_coroutines_core_version = "1.7.1"
legacy_preference_v14_version = "1.0.0"
lifecycle_ext = "2.2.0"
lifecycle_version = "2.5.1"
material_version = "1.7.0"
lifecycle_version = "2.6.2"
material_version = "1.10.0"
multidex_version = "2.0.1"
preference_version = "1.2.0"
room_version = "2.4.3"
preference_version = "1.2.1"
room_version = "2.6.0"

// test dependencies
junit_version = "4.13.2"
runner_version = "1.5.1"
espresso_core_version = "3.5.0"
runner_version = "1.5.2"
espresso_core_version = "3.5.1"
}

task clean(type: Delete) {
Expand Down
Loading

0 comments on commit c41bbaf

Please sign in to comment.