Files
flipper/android
Zac Sweers 64c32f62b1 Tag sockets in FlipperSocketImpl (#3928)
Summary:
Resolves https://github.com/facebook/flipper/issues/3926. Open to suggestions on the tag value, just sort of picked one that could be pointed to for anyone that wants to track these in their apps.

## Changelog

Tag sockets used by Flipper to fix strict mode warnings about untagged sockets.

Pull Request resolved: https://github.com/facebook/flipper/pull/3928

Test Plan:
Edit FlipperSampleApplication.java with the following:

```
public class FlipperSampleApplication extends Application {
  Override
  public void onCreate() {

    StrictMode.setThreadPolicy(
            new StrictMode.ThreadPolicy.Builder()
                    .detectAll()
                    .penaltyLog()
                    .build()
    );
    StrictMode.setVmPolicy(
            new StrictMode.VmPolicy.Builder()
                    .detectAll()
                    .penaltyLog()
                    .build()
    );
...
```

That will enable strict mode. Now build/launch the sample application.

Use adb logcat to inspect warnings:

```
 adb logcat -s StrictMode
```

Without tagging the socket, the following warning should be observed:

```
D/StrictMode: StrictMode policy violation: android.os.strictmode.UntaggedSocketViolation: Untagged socket detected; use TrafficStats.setTrafficStatsTag() to track all network usage
```

After applying the fix, that warning should go away.

Reviewed By: lblasa

Differential Revision: D38280819

Pulled By: passy

fbshipit-source-id: 0c841b13237cbcb0ff8b8226fb44655a74b775c6
2022-08-01 08:34:00 -07:00
..
2022-07-28 06:59:11 -07:00