Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 096f175b authored by Yi Kong's avatar Yi Kong Committed by Gerrit Code Review
Browse files

Merge "profcollect: Broadcast intent when a profile report is ready to upload"

parents bd3a33ed 61db7cd4
Loading
Loading
Loading
Loading
+25 −5
Original line number Diff line number Diff line
@@ -295,10 +295,30 @@ public final class ProfcollectForwardingService extends SystemService {
            return;
        }

        final boolean uploadReport =
                DeviceConfig.getBoolean(DeviceConfig.NAMESPACE_PROFCOLLECT_NATIVE_BOOT,
                                        "upload_report", false);

        new Thread(() -> {
            try {
            mIProfcollect.report();
                String reportPath = mIProfcollect.report();
                if (!uploadReport) {
                    return;
                }
                Intent uploadIntent =
                        new Intent("com.google.android.apps.betterbug.intent.action.UPLOAD_PROFILE")
                        .setPackage("com.google.android.apps.internal.betterbug")
                        .putExtra("EXTRA_DESTINATION", "PROFCOLLECT")
                        .putExtra("EXTRA_PACKAGE_NAME", getContext().getPackageName())
                        .putExtra("EXTRA_PROFILE_PATH", reportPath)
                        .addFlags(Intent.FLAG_RECEIVER_FOREGROUND);
                Context context = getContext();
                if (context.getPackageManager().queryBroadcastReceivers(uploadIntent, 0) != null) {
                    context.sendBroadcast(uploadIntent);
                }
            } catch (RemoteException e) {
                Log.e(LOG_TAG, e.getMessage());
            }
        }).start();
    }
}