From e5daa72580516d75eb4563d8d6010753ddd36e54 Mon Sep 17 00:00:00 2001 From: Sandro Montanari Date: Mon, 16 Dec 2024 12:16:18 +0000 Subject: [PATCH] Replace start job action with UPDATE_CT_LOGS system api Instead of defining our own action we can use the @SystemApi already defined in ConfigUpdate. Flag: android.security.Flags.certificate_transparency_configuration Bug: 319829948 Test: atest NetworkSecurityUnitTests Change-Id: Ibb3a534c0e0dca12a075d031983a8ee754261abd --- .../server/net/ct/CertificateTransparencyJob.java | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/networksecurity/service/src/com/android/server/net/ct/CertificateTransparencyJob.java b/networksecurity/service/src/com/android/server/net/ct/CertificateTransparencyJob.java index bf23cb09d4..1c20b989a4 100644 --- a/networksecurity/service/src/com/android/server/net/ct/CertificateTransparencyJob.java +++ b/networksecurity/service/src/com/android/server/net/ct/CertificateTransparencyJob.java @@ -23,6 +23,7 @@ import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.os.Build; +import android.os.ConfigUpdate; import android.os.SystemClock; import android.util.Log; @@ -32,8 +33,6 @@ public class CertificateTransparencyJob extends BroadcastReceiver { private static final String TAG = "CertificateTransparencyJob"; - private static final String ACTION_JOB_START = "com.android.server.net.ct.action.JOB_START"; - private final Context mContext; private final DataStore mDataStore; private final CertificateTransparencyDownloader mCertificateTransparencyDownloader; @@ -55,13 +54,18 @@ public class CertificateTransparencyJob extends BroadcastReceiver { mCertificateTransparencyDownloader.initialize(); mContext.registerReceiver( - this, new IntentFilter(ACTION_JOB_START), Context.RECEIVER_EXPORTED); + this, + new IntentFilter(ConfigUpdate.ACTION_UPDATE_CT_LOGS), + Context.RECEIVER_EXPORTED); mAlarmManager.setInexactRepeating( AlarmManager.ELAPSED_REALTIME, SystemClock.elapsedRealtime(), // schedule first job at earliest convenient time. AlarmManager.INTERVAL_DAY, PendingIntent.getBroadcast( - mContext, 0, new Intent(ACTION_JOB_START), PendingIntent.FLAG_IMMUTABLE)); + mContext, + 0, + new Intent(ConfigUpdate.ACTION_UPDATE_CT_LOGS), + PendingIntent.FLAG_IMMUTABLE)); if (Config.DEBUG) { Log.d(TAG, "CertificateTransparencyJob scheduled successfully."); @@ -70,7 +74,7 @@ public class CertificateTransparencyJob extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { - if (!ACTION_JOB_START.equals(intent.getAction())) { + if (!ConfigUpdate.ACTION_UPDATE_CT_LOGS.equals(intent.getAction())) { Log.w(TAG, "Received unexpected broadcast with action " + intent); return; }