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

Commit 5b1fc8bb authored by Isma Cortes's avatar Isma Cortes Committed by Android (Google) Code Review
Browse files

Merge "Display WearBugreportWarningActivity on Wear after bugreport is done"

parents 35a3e7a3 c324562b
Loading
Loading
Loading
Loading
+19 −1
Original line number Diff line number Diff line
@@ -1212,13 +1212,31 @@ public class BugreportProgressService extends Service {

    private void maybeShowWarningMessageAndCloseNotification(int id) {
        if (!hasUserDecidedNotToGetWarningMessage()) {
            Intent warningIntent = buildWarningIntent(mContext, /* sendIntent */ null);
            Intent warningIntent;
            if (mIsWatch) {
                warningIntent = buildWearWarningIntent();
            } else {
                warningIntent = buildWarningIntent(mContext, /* sendIntent */ null);
            }
            warningIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            mContext.startActivity(warningIntent);
        }
        NotificationManager.from(mContext).cancel(id);
    }

    /**
     * Build intent to show warning dialog on Wear after bugreport is done
     */
    private Intent buildWearWarningIntent() {
        Intent intent = new Intent();
        intent.setClassName(mContext, getPackageName() + ".WearBugreportWarningActivity");
        if (mContext.getPackageManager().resolveActivity(intent, /* flags */ 0) == null) {
            Log.e(TAG, "Cannot find wear bugreport warning activity");
            return buildWarningIntent(mContext, /* sendIntent */ null);
        }
        return intent;
    }

    private void shareBugreport(int id, BugreportInfo sharedInfo) {
        shareBugreport(id, sharedInfo, !hasUserDecidedNotToGetWarningMessage());
    }