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

Commit 67ca8fb7 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "profcollectd: Avoid hard-coding Betterbug name" into sc-dev am: 503d4d6c

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15090021

Change-Id: Ic5f8f914c3c3310b4ff7332d2968c04581ffdb91
parents 6a6f07c5 503d4d6c
Loading
Loading
Loading
Loading
+9 −0
Original line number Original line Diff line number Diff line
@@ -4635,6 +4635,15 @@
    <!-- The package name for the default bug report handler app from power menu short press. This app must be allowlisted. -->
    <!-- The package name for the default bug report handler app from power menu short press. This app must be allowlisted. -->
    <string name="config_defaultBugReportHandlerApp" translatable="false"></string>
    <string name="config_defaultBugReportHandlerApp" translatable="false"></string>


    <!-- When true, enables the allowlisted app to upload profcollect reports. -->
    <bool name="config_profcollectReportUploaderEnabled">false</bool>

    <!-- The package name for the default profcollect report uploader app. This app must be allowlisted. -->
    <string name="config_defaultProfcollectReportUploaderApp" translatable="false"></string>

    <!-- The action name for the default profcollect report uploader app. -->
    <string name="config_defaultProfcollectReportUploaderAction" translatable="false"></string>

    <!-- The default value used for RawContacts.ACCOUNT_NAME when contacts are inserted without this
    <!-- The default value used for RawContacts.ACCOUNT_NAME when contacts are inserted without this
         column set. These contacts are stored locally on the device and will not be removed even
         column set. These contacts are stored locally on the device and will not be removed even
         if no android.account.Account with this name exists. A null string will be used if the
         if no android.account.Account with this name exists. A null string will be used if the
+5 −0
Original line number Original line Diff line number Diff line
@@ -4019,6 +4019,11 @@
  <java-symbol type="bool" name="config_bugReportHandlerEnabled" />
  <java-symbol type="bool" name="config_bugReportHandlerEnabled" />
  <java-symbol type="string" name="config_defaultBugReportHandlerApp" />
  <java-symbol type="string" name="config_defaultBugReportHandlerApp" />


  <!-- For profcollect report uploader -->
  <java-symbol type="bool" name="config_profcollectReportUploaderEnabled" />
  <java-symbol type="string" name="config_defaultProfcollectReportUploaderApp" />
  <java-symbol type="string" name="config_defaultProfcollectReportUploaderAction" />

  <java-symbol type="string" name="usb_device_resolve_prompt_warn" />
  <java-symbol type="string" name="usb_device_resolve_prompt_warn" />


  <!-- For Accessibility system actions -->
  <!-- For Accessibility system actions -->
+25 −3
Original line number Original line Diff line number Diff line
@@ -37,6 +37,7 @@ import android.os.UserManager;
import android.provider.DeviceConfig;
import android.provider.DeviceConfig;
import android.util.Log;
import android.util.Log;


import com.android.internal.R;
import com.android.server.IoThread;
import com.android.server.IoThread;
import com.android.server.LocalServices;
import com.android.server.LocalServices;
import com.android.server.SystemService;
import com.android.server.SystemService;
@@ -302,8 +303,15 @@ public final class ProfcollectForwardingService extends SystemService {
            return;
            return;
        }
        }


        if (!getUploaderEnabledConfig(getContext())) {
            return;
        }

        new Thread(() -> {
        new Thread(() -> {
            try {
            try {
                Context context = getContext();
                final String uploaderPkg = getUploaderPackageName(context);
                final String uploaderAction = getUploaderActionName(context);
                String reportUuid = mIProfcollect.report();
                String reportUuid = mIProfcollect.report();


                final int profileId = getBBProfileId();
                final int profileId = getBBProfileId();
@@ -317,13 +325,12 @@ public final class ProfcollectForwardingService extends SystemService {
                }
                }


                Intent uploadIntent =
                Intent uploadIntent =
                        new Intent("com.google.android.apps.betterbug.intent.action.UPLOAD_PROFILE")
                        new Intent(uploaderAction)
                        .setPackage("com.google.android.apps.internal.betterbug")
                        .setPackage(uploaderPkg)
                        .putExtra("EXTRA_DESTINATION", "PROFCOLLECT")
                        .putExtra("EXTRA_DESTINATION", "PROFCOLLECT")
                        .putExtra("EXTRA_PACKAGE_NAME", getContext().getPackageName())
                        .putExtra("EXTRA_PACKAGE_NAME", getContext().getPackageName())
                        .putExtra("EXTRA_PROFILE_PATH", reportPath)
                        .putExtra("EXTRA_PROFILE_PATH", reportPath)
                        .addFlags(Intent.FLAG_RECEIVER_FOREGROUND);
                        .addFlags(Intent.FLAG_RECEIVER_FOREGROUND);
                Context context = getContext();


                List<ResolveInfo> receivers =
                List<ResolveInfo> receivers =
                        context.getPackageManager().queryBroadcastReceivers(uploadIntent, 0);
                        context.getPackageManager().queryBroadcastReceivers(uploadIntent, 0);
@@ -356,4 +363,19 @@ public final class ProfcollectForwardingService extends SystemService {
        }
        }
        return UserHandle.USER_SYSTEM;
        return UserHandle.USER_SYSTEM;
    }
    }

    private boolean getUploaderEnabledConfig(Context context) {
        return context.getResources().getBoolean(
            R.bool.config_profcollectReportUploaderEnabled);
    }

    private String getUploaderPackageName(Context context) {
        return context.getResources().getString(
            R.string.config_defaultProfcollectReportUploaderApp);
    }

    private String getUploaderActionName(Context context) {
        return context.getResources().getString(
            R.string.config_defaultProfcollectReportUploaderAction);
    }
}
}