File tree Expand file tree Collapse file tree 3 files changed +10
-9
lines changed
firebase-sessions/test-app/src/main/kotlin/com/google/firebase/testing/sessions Expand file tree Collapse file tree 3 files changed +10
-9
lines changed Original file line number Diff line number Diff line change @@ -30,6 +30,7 @@ open class BaseActivity : AppCompatActivity() {
3030 override fun onCreate (savedInstanceState : Bundle ? ) {
3131 super .onCreate(savedInstanceState)
3232 FirebaseApp .initializeApp(this )
33+ logProcessDetails()
3334 Log .i(TAG , " onCreate - ${getProcessName()} - ${getImportance()} " )
3435 }
3536
@@ -64,9 +65,16 @@ open class BaseActivity : AppCompatActivity() {
6465 return processInfo.importance
6566 }
6667
67- private fun getProcessName (): String =
68+ protected fun getProcessName (): String =
6869 if (Build .VERSION .SDK_INT >= Build .VERSION_CODES .P ) Application .getProcessName() else " unknown"
6970
71+ private fun logProcessDetails () {
72+ val pid = android.os.Process .myPid()
73+ val uid = android.os.Process .myUid()
74+ val activity = javaClass.name
75+ Log .i(TAG , " activity: $activity pid: $pid , uid: $uid " )
76+ }
77+
7078 companion object {
7179 val TAG = " BaseActivity"
7280 }
Original file line number Diff line number Diff line change @@ -104,7 +104,7 @@ class FirstFragment : Fragment() {
104104 intent.addFlags(FLAG_ACTIVITY_NEW_TASK )
105105 startActivity(intent)
106106 }
107- binding.processName.setText( getProcessName() )
107+ binding.processName.text = getProcessName()
108108 }
109109
110110 override fun onResume () {
Original file line number Diff line number Diff line change 1717package com.google.firebase.testing.sessions
1818
1919import android.app.ActivityManager
20- import android.app.Application
2120import android.content.Intent
2221import android.content.Intent.FLAG_ACTIVITY_NEW_TASK
2322import android.os.Build
@@ -69,10 +68,4 @@ class SecondActivity : BaseActivity() {
6968 super .onPause()
7069 TestApplication .sessionSubscriber.unregisterView(findViewById(R .id.session_id_second_text))
7170 }
72-
73- companion object {
74- fun getProcessName (): String =
75- if (Build .VERSION .SDK_INT >= Build .VERSION_CODES .P ) Application .getProcessName()
76- else " unknown"
77- }
7871}
You can’t perform that action at this time.
0 commit comments