-
Notifications
You must be signed in to change notification settings - Fork 768
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6300 from vector-im/feature/bma/flipper
Setup Flipper
- Loading branch information
Showing
29 changed files
with
380 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Setup [Flipper](https://fbflipper.com/) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
# Flipper | ||
|
||
<!--- TOC --> | ||
|
||
* [Introduction](#introduction) | ||
* [Setup](#setup) | ||
* [Troubleshoot](#troubleshoot) | ||
* [No device found issue](#no-device-found-issue) | ||
* [Diagnostic Activity](#diagnostic-activity) | ||
* [Other](#other) | ||
* [Links](#links) | ||
|
||
<!--- END --> | ||
|
||
## Introduction | ||
|
||
[Flipper](https://fbflipper.com) is a powerful tool from Meta, which allow to inspect the running application details and states from your computer. | ||
|
||
Flipper is configured in the Element Android project to let the developers be able to: | ||
- inspect all the Realm databases content; | ||
- do layout inspection; | ||
- see the crash logs; | ||
- see the logcat; | ||
- see all the network requests; | ||
- see all the SharedPreferences; | ||
- take screenshots and record videos of the device; | ||
- and more! | ||
|
||
## Setup | ||
|
||
- Install Flipper on your computer. Follow instructions here: https://fbflipper.com/docs/getting-started/index/ | ||
- Run the debug version of Element on an emulator or on a real device. | ||
|
||
### Troubleshoot | ||
|
||
#### No device found issue | ||
|
||
The configuration of the Flipper application has to be updated. The issue has been asked and answered here: https://stackoverflow.com/questions/71744103/android-emulator-unable-to-connect-to-flipper/72608113#72608113 | ||
|
||
#### Diagnostic Activity | ||
|
||
Flipper comes with a Diagnostic Activity that you can start from command line using: | ||
|
||
```shell | ||
adb shell am start -n im.vector.app.debug/com.facebook.flipper.android.diagnostics.FlipperDiagnosticActivity | ||
``` | ||
|
||
It provides some log which can help to figure out what's going on client side. | ||
|
||
#### Other | ||
|
||
https://fbflipper.com/docs/getting-started/troubleshooting/android/ may help. | ||
|
||
## Links | ||
|
||
- https://fbflipper.com | ||
- Realm Plugin for Flipper: https://github.com/kamgurgul/Flipper-Realm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/debug/DebugService.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* | ||
* Copyright (c) 2022 The Matrix.org Foundation C.I.C. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.matrix.android.sdk.api.debug | ||
|
||
import io.realm.RealmConfiguration | ||
|
||
/** | ||
* Useful methods to access to some private data managed by the SDK. | ||
*/ | ||
interface DebugService { | ||
/** | ||
* Get all the available Realm Configuration. | ||
*/ | ||
fun getAllRealmConfigurations(): List<RealmConfiguration> | ||
|
||
/** | ||
* Prints out info on DB size to logcat. | ||
*/ | ||
fun logDbUsageInfo() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/debug/DebugModule.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* | ||
* Copyright (c) 2022 The Matrix.org Foundation C.I.C. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
*/ | ||
|
||
package org.matrix.android.sdk.internal.debug | ||
|
||
import dagger.Binds | ||
import dagger.Module | ||
import org.matrix.android.sdk.api.debug.DebugService | ||
|
||
@Module | ||
internal abstract class DebugModule { | ||
|
||
@Binds | ||
abstract fun bindDebugService(service: DefaultDebugService): DebugService | ||
} |
44 changes: 44 additions & 0 deletions
44
...ix-sdk-android/src/main/java/org/matrix/android/sdk/internal/debug/DefaultDebugService.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/* | ||
* Copyright (c) 2022 The Matrix.org Foundation C.I.C. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.matrix.android.sdk.internal.debug | ||
|
||
import io.realm.RealmConfiguration | ||
import org.matrix.android.sdk.api.debug.DebugService | ||
import org.matrix.android.sdk.internal.SessionManager | ||
import org.matrix.android.sdk.internal.database.tools.RealmDebugTools | ||
import org.matrix.android.sdk.internal.di.AuthDatabase | ||
import org.matrix.android.sdk.internal.di.GlobalDatabase | ||
import javax.inject.Inject | ||
|
||
internal class DefaultDebugService @Inject constructor( | ||
@AuthDatabase private val realmConfigurationAuth: RealmConfiguration, | ||
@GlobalDatabase private val realmConfigurationGlobal: RealmConfiguration, | ||
private val sessionManager: SessionManager, | ||
) : DebugService { | ||
|
||
override fun getAllRealmConfigurations(): List<RealmConfiguration> { | ||
return sessionManager.getLastSession()?.getRealmConfigurations().orEmpty() + | ||
realmConfigurationAuth + | ||
realmConfigurationGlobal | ||
} | ||
|
||
override fun logDbUsageInfo() { | ||
RealmDebugTools(realmConfigurationAuth).logInfo("Auth") | ||
RealmDebugTools(realmConfigurationGlobal).logInfo("Global") | ||
sessionManager.getLastSession()?.logDbUsageInfo() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.