Import updated Android SetupCompat Library 378593677

Copied from google3/third_party/java_src/android_libs/setupcompat

Test: mm
Bug: 190562325

Included changes:
  - 378593677 [SetupDesign] Dynamic primary button - fix the primary bu...
  - 378572218 Rollback P100 color
  - 378372241 Add missed log in setupcompat
  - 378097631 [DynamicColor] Moves the function that apply dynamic colo...
  - 377838411 Consolidate log tag of setupdesign and setupcompat library
  - 377415349 Apply dynamic color P100 on a primary-style secondary but...

PiperOrigin-RevId: 378593677
Change-Id: I7384eaccb01cb95199ad281abb476e5c7c2f4ca4
diff --git a/main/java/com/google/android/setupcompat/PartnerCustomizationLayout.java b/main/java/com/google/android/setupcompat/PartnerCustomizationLayout.java
index 466f036..e5ba0c5 100644
--- a/main/java/com/google/android/setupcompat/PartnerCustomizationLayout.java
+++ b/main/java/com/google/android/setupcompat/PartnerCustomizationLayout.java
@@ -26,7 +26,6 @@
 import android.os.Build.VERSION_CODES;
 import android.os.PersistableBundle;
 import android.util.AttributeSet;
-import android.util.Log;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.ViewGroup;
@@ -43,12 +42,13 @@
 import com.google.android.setupcompat.template.StatusBarMixin;
 import com.google.android.setupcompat.template.SystemNavBarMixin;
 import com.google.android.setupcompat.util.BuildCompatUtils;
+import com.google.android.setupcompat.util.Logger;
 import com.google.android.setupcompat.util.WizardManagerHelper;
 
 /** A templatization layout with consistent style used in Setup Wizard or app itself. */
 public class PartnerCustomizationLayout extends TemplateLayout {
-  // Log tags can have at most 23 characters on N or before.
-  private static final String TAG = "PartnerCustomizedLayout";
+
+  private static final Logger LOG = new Logger("PartnerCustomizationLayout");
 
   /**
    * Attribute indicating whether usage of partner theme resources is allowed. This corresponds to
@@ -163,7 +163,7 @@
 
     if (!a.hasValue(R.styleable.SucPartnerCustomizationLayout_sucUsePartnerResource)) {
       // TODO: Enable Log.WTF after other client already set sucUsePartnerResource.
-      Log.e(TAG, "Attribute sucUsePartnerResource not found in " + activity.getComponentName());
+      LOG.e("Attribute sucUsePartnerResource not found in " + activity.getComponentName());
     }
 
     usePartnerResourceAttr =
@@ -176,22 +176,19 @@
 
     a.recycle();
 
-    if (Log.isLoggable(TAG, Log.DEBUG)) {
-      Log.d(
-          TAG,
-          "activity="
-              + activity.getClass().getSimpleName()
-              + " isSetupFlow="
-              + isSetupFlow
-              + " enablePartnerResourceLoading="
-              + enablePartnerResourceLoading()
-              + " usePartnerResourceAttr="
-              + usePartnerResourceAttr
-              + " useDynamicColor="
-              + useDynamicColor
-              + " useFullDynamicColorAttr="
-              + useFullDynamicColorAttr);
-    }
+    LOG.atDebug(
+        "activity="
+            + activity.getClass().getSimpleName()
+            + " isSetupFlow="
+            + isSetupFlow
+            + " enablePartnerResourceLoading="
+            + enablePartnerResourceLoading()
+            + " usePartnerResourceAttr="
+            + usePartnerResourceAttr
+            + " useDynamicColor="
+            + useDynamicColor
+            + " useFullDynamicColorAttr="
+            + useFullDynamicColorAttr);
   }
 
   @Override
diff --git a/main/java/com/google/android/setupcompat/internal/PersistableBundles.java b/main/java/com/google/android/setupcompat/internal/PersistableBundles.java
index f02265a..3b7d5a5 100644
--- a/main/java/com/google/android/setupcompat/internal/PersistableBundles.java
+++ b/main/java/com/google/android/setupcompat/internal/PersistableBundles.java
@@ -22,7 +22,7 @@
 import android.os.Bundle;
 import android.os.PersistableBundle;
 import android.util.ArrayMap;
-import android.util.Log;
+import com.google.android.setupcompat.util.Logger;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collections;
@@ -32,6 +32,8 @@
 @TargetApi(VERSION_CODES.LOLLIPOP_MR1)
 public final class PersistableBundles {
 
+  private static final Logger LOG = new Logger("PersistableBundles");
+
   /**
    * Merges two or more {@link PersistableBundle}. Ensures no conflict of keys occurred during
    * merge.
@@ -121,7 +123,7 @@
     for (String key : baseBundle.keySet()) {
       Object value = baseBundle.get(key);
       if (!isSupportedDataType(value)) {
-        Log.w(TAG, String.format("Unknown/unsupported data type [%s] for key %s", value, key));
+        LOG.w(String.format("Unknown/unsupported data type [%s] for key %s", value, key));
         continue;
       }
       map.put(key, baseBundle.get(key));
@@ -141,6 +143,4 @@
   private PersistableBundles() {
     throw new AssertionError("Should not be instantiated");
   }
-
-  private static final String TAG = "SetupCompat.PersistBls";
 }
diff --git a/main/java/com/google/android/setupcompat/internal/SetupCompatServiceInvoker.java b/main/java/com/google/android/setupcompat/internal/SetupCompatServiceInvoker.java
index 779cc8a..149da54 100644
--- a/main/java/com/google/android/setupcompat/internal/SetupCompatServiceInvoker.java
+++ b/main/java/com/google/android/setupcompat/internal/SetupCompatServiceInvoker.java
@@ -20,10 +20,10 @@
 import android.content.Context;
 import android.os.Bundle;
 import android.os.RemoteException;
-import android.util.Log;
 import androidx.annotation.VisibleForTesting;
 import com.google.android.setupcompat.ISetupCompatService;
 import com.google.android.setupcompat.logging.internal.SetupMetricsLoggingConstants.MetricType;
+import com.google.android.setupcompat.util.Logger;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.RejectedExecutionException;
 import java.util.concurrent.TimeUnit;
@@ -41,11 +41,14 @@
  */
 public class SetupCompatServiceInvoker {
 
+  private static final Logger LOG = new Logger("SetupCompatServiceInvoker");
+
+  @SuppressLint("DefaultLocale")
   public void logMetricEvent(@MetricType int metricType, Bundle args) {
     try {
       loggingExecutor.execute(() -> invokeLogMetric(metricType, args));
     } catch (RejectedExecutionException e) {
-      Log.e(TAG, String.format("Metric of type %d dropped since queue is full.", metricType), e);
+      LOG.e(String.format("Metric of type %d dropped since queue is full.", metricType), e);
     }
   }
 
@@ -53,7 +56,7 @@
     try {
       setupCompatExecutor.execute(() -> invokeBindBack(screenName, bundle));
     } catch (RejectedExecutionException e) {
-      Log.e(TAG, String.format("Screen %s bind back fail.", screenName), e);
+      LOG.e(String.format("Screen %s bind back fail.", screenName), e);
     }
   }
 
@@ -66,10 +69,10 @@
       if (setupCompatService != null) {
         setupCompatService.logMetric(metricType, args, Bundle.EMPTY);
       } else {
-        Log.w(TAG, "logMetric failed since service reference is null. Are the permissions valid?");
+        LOG.w("logMetric failed since service reference is null. Are the permissions valid?");
       }
     } catch (InterruptedException | TimeoutException | RemoteException | IllegalStateException e) {
-      Log.e(TAG, String.format("Exception occurred while trying to log metric = [%s]", args), e);
+      LOG.e(String.format("Exception occurred while trying to log metric = [%s]", args), e);
     }
   }
 
@@ -81,11 +84,10 @@
       if (setupCompatService != null) {
         setupCompatService.validateActivity(screenName, bundle);
       } else {
-        Log.w(TAG, "BindBack failed since service reference is null. Are the permissions valid?");
+        LOG.w("BindBack failed since service reference is null. Are the permissions valid?");
       }
     } catch (InterruptedException | TimeoutException | RemoteException e) {
-      Log.e(
-          TAG,
+      LOG.e(
           String.format("Exception occurred while %s trying bind back to SetupWizard.", screenName),
           e);
     }
@@ -125,5 +127,4 @@
   private static SetupCompatServiceInvoker instance;
 
   private static final long MAX_WAIT_TIME_FOR_CONNECTION_MS = TimeUnit.SECONDS.toMillis(10);
-  private static final String TAG = "SucServiceInvoker";
 }
diff --git a/main/java/com/google/android/setupcompat/internal/SetupCompatServiceProvider.java b/main/java/com/google/android/setupcompat/internal/SetupCompatServiceProvider.java
index 12c0a92..e75d991 100644
--- a/main/java/com/google/android/setupcompat/internal/SetupCompatServiceProvider.java
+++ b/main/java/com/google/android/setupcompat/internal/SetupCompatServiceProvider.java
@@ -23,11 +23,11 @@
 import android.content.ServiceConnection;
 import android.os.IBinder;
 import android.os.Looper;
-import android.util.Log;
 import androidx.annotation.NonNull;
 import androidx.annotation.Nullable;
 import androidx.annotation.VisibleForTesting;
 import com.google.android.setupcompat.ISetupCompatService;
+import com.google.android.setupcompat.util.Logger;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.TimeoutException;
@@ -40,6 +40,8 @@
  */
 public class SetupCompatServiceProvider {
 
+  private static final Logger LOG = new Logger("SetupCompatServiceProvider");
+
   /**
    * Returns an instance of {@link ISetupCompatService} if one already exists. If not, attempts to
    * rebind if the current state allows such an operation and waits until {@code waitTime} for
@@ -94,7 +96,7 @@
     }
 
     CountDownLatch connectedStateLatch = getConnectedCondition();
-    Log.i(TAG, "Waiting for service to get connected");
+    LOG.atInfo("Waiting for service to get connected");
     boolean stateChanged = connectedStateLatch.await(timeout, timeUnit);
     if (!stateChanged) {
       // Even though documentation states that disconnected service should connect again,
@@ -104,13 +106,10 @@
           String.format("Failed to acquire connection after [%s %s]", timeout, timeUnit));
     }
     currentServiceState = getCurrentServiceState();
-    if (Log.isLoggable(TAG, Log.INFO)) {
-      Log.i(
-          TAG,
-          String.format(
-              "Finished waiting for service to get connected. Current state = %s",
-              currentServiceState.state));
-    }
+    LOG.atInfo(
+        String.format(
+            "Finished waiting for service to get connected. Current state = %s",
+            currentServiceState.state));
     return currentServiceState.compatService;
   }
 
@@ -126,11 +125,11 @@
   private synchronized void requestServiceBind() {
     ServiceContext currentServiceState = getCurrentServiceState();
     if (currentServiceState.state == State.CONNECTED) {
-      Log.i(TAG, "Refusing to rebind since current state is already connected");
+      LOG.atInfo("Refusing to rebind since current state is already connected");
       return;
     }
     if (currentServiceState.state != State.NOT_STARTED) {
-      Log.i(TAG, "Unbinding existing service connection.");
+      LOG.atInfo("Unbinding existing service connection.");
       context.unbindService(serviceConnection);
     }
 
@@ -139,7 +138,7 @@
       bindAllowed =
           context.bindService(COMPAT_SERVICE_INTENT, serviceConnection, Context.BIND_AUTO_CREATE);
     } catch (SecurityException e) {
-      Log.e(TAG, "Unable to bind to compat service", e);
+      LOG.e("Unable to bind to compat service. " + e);
       bindAllowed = false;
     }
 
@@ -149,12 +148,12 @@
       // in the normal world
       if (getCurrentState() != State.CONNECTED) {
         swapServiceContextAndNotify(new ServiceContext(State.BINDING));
-        Log.i(TAG, "Context#bindService went through, now waiting for service connection");
+        LOG.atInfo("Context#bindService went through, now waiting for service connection");
       }
     } else {
       // SetupWizard is not installed/calling app does not have permissions to bind.
       swapServiceContextAndNotify(new ServiceContext(State.BIND_FAILED));
-      Log.e(TAG, "Context#bindService did not succeed.");
+      LOG.e("Context#bindService did not succeed.");
     }
   }
 
@@ -174,12 +173,9 @@
   }
 
   private void swapServiceContextAndNotify(ServiceContext latestServiceContext) {
-    if (Log.isLoggable(TAG, Log.INFO)) {
-      Log.i(
-          TAG,
-          String.format(
-              "State changed: %s -> %s", serviceContext.state, latestServiceContext.state));
-    }
+    LOG.atInfo(
+        String.format("State changed: %s -> %s", serviceContext.state, latestServiceContext.state));
+
     serviceContext = latestServiceContext;
     CountDownLatch countDownLatch = getAndClearConnectedCondition();
     if (countDownLatch != null) {
@@ -221,7 +217,7 @@
           State state = State.CONNECTED;
           if (binder == null) {
             state = State.DISCONNECTED;
-            Log.w(TAG, "Binder is null when onServiceConnected was called!");
+            LOG.w("Binder is null when onServiceConnected was called!");
           }
           swapServiceContextAndNotify(
               new ServiceContext(state, ISetupCompatService.Stub.asInterface(binder)));
@@ -336,6 +332,4 @@
   // lint error.
   @SuppressLint("StaticFieldLeak")
   private static volatile SetupCompatServiceProvider instance;
-
-  private static final String TAG = "SucServiceProvider";
 }
diff --git a/main/java/com/google/android/setupcompat/portal/PortalHelper.java b/main/java/com/google/android/setupcompat/portal/PortalHelper.java
index 370db96..4d1965a 100644
--- a/main/java/com/google/android/setupcompat/portal/PortalHelper.java
+++ b/main/java/com/google/android/setupcompat/portal/PortalHelper.java
@@ -27,15 +27,15 @@
 import android.os.Process;
 import android.os.RemoteException;
 import android.os.UserHandle;
-import android.util.Log;
 import androidx.annotation.NonNull;
 import com.google.android.setupcompat.internal.Preconditions;
 import com.google.android.setupcompat.portal.PortalConstants.RemainingValues;
+import com.google.android.setupcompat.util.Logger;
 
 /** This class is responsible for safely executing methods on SetupNotificationService. */
 public class PortalHelper {
 
-  private static final String TAG = "PortalHelper";
+  private static final Logger LOG = new Logger("PortalHelper");
 
   public static final String EXTRA_KEY_IS_SETUP_WIZARD = "isSetupWizard";
 
@@ -62,7 +62,7 @@
     try {
       return context.bindService(NOTIFICATION_SERVICE_INTENT, connection, Context.BIND_AUTO_CREATE);
     } catch (SecurityException e) {
-      Log.e(TAG, "Exception occurred while binding SetupNotificationService", e);
+      LOG.e("Exception occurred while binding SetupNotificationService", e);
       return false;
     }
   }
@@ -136,7 +136,7 @@
         };
 
     if (!bindSetupNotificationService(context, connection)) {
-      Log.e(TAG, "Failed to bind SetupNotificationService.");
+      LOG.e("Failed to bind SetupNotificationService.");
       callback.onFailure(new SecurityException("Failed to bind SetupNotificationService."));
     }
   }
@@ -154,7 +154,7 @@
               try {
                 listener.onResult(service.isPortalAvailable());
               } catch (RemoteException e) {
-                Log.w(TAG, "Failed to invoke SetupNotificationService#isPortalAvailable");
+                LOG.e("Failed to invoke SetupNotificationService#isPortalAvailable");
                 listener.onResult(false);
               }
             }
@@ -166,8 +166,7 @@
         };
 
     if (!bindSetupNotificationService(context, connection)) {
-      Log.e(
-          TAG,
+      LOG.e(
           "Failed to bind SetupNotificationService. Do you have permission"
               + " \"com.google.android.setupwizard.SETUP_PROGRESS_SERVICE\"");
       listener.onResult(false);
@@ -199,7 +198,7 @@
                 }
 
               } catch (RemoteException e) {
-                Log.w(TAG, "Failed to invoke SetupNotificationService#isProgressServiceAlive");
+                LOG.w("Failed to invoke SetupNotificationService#isProgressServiceAlive");
                 listener.onResult(false);
               }
             }
@@ -211,8 +210,7 @@
         };
 
     if (!bindSetupNotificationService(context, connection)) {
-      Log.e(
-          TAG,
+      LOG.e(
           "Failed to bind SetupNotificationService. Do you have permission"
               + " \"com.google.android.setupwizard.SETUP_PROGRESS_SERVICE\"");
       listener.onResult(false);
diff --git a/main/java/com/google/android/setupcompat/template/FooterBarMixin.java b/main/java/com/google/android/setupcompat/template/FooterBarMixin.java
index a0bb65b..b75d972 100644
--- a/main/java/com/google/android/setupcompat/template/FooterBarMixin.java
+++ b/main/java/com/google/android/setupcompat/template/FooterBarMixin.java
@@ -358,10 +358,6 @@
 
     onFooterButtonInflated(button, footerBarPrimaryBackgroundColor);
     onFooterButtonApplyPartnerResource(button, footerButtonPartnerConfig);
-    // Sets the primary button background to a light accent color
-    if (applyDynamicColor) {
-      FooterButtonStyleUtils.applyDynamicColorOnPrimaryButton(context, button);
-    }
 
     // Make sure the position of buttons are correctly and prevent primary button create twice or
     // more.
diff --git a/main/java/com/google/android/setupcompat/template/FooterButtonStyleUtils.java b/main/java/com/google/android/setupcompat/template/FooterButtonStyleUtils.java
index ca4d56b..ef45b5c 100644
--- a/main/java/com/google/android/setupcompat/template/FooterButtonStyleUtils.java
+++ b/main/java/com/google/android/setupcompat/template/FooterButtonStyleUtils.java
@@ -126,13 +126,13 @@
           footerButtonPartnerConfig.getButtonBackgroundConfig(),
           footerButtonPartnerConfig.getButtonDisableAlphaConfig(),
           footerButtonPartnerConfig.getButtonDisableBackgroundConfig());
-      FooterButtonStyleUtils.updateButtonRippleColorWithPartnerConfig(
-          context,
-          button,
-          footerButtonPartnerConfig.getButtonTextColorConfig(),
-          footerButtonPartnerConfig.getButtonRippleColorAlphaConfig());
     }
-
+    FooterButtonStyleUtils.updateButtonRippleColorWithPartnerConfig(
+        context,
+        button,
+        applyDynamicColor,
+        footerButtonPartnerConfig.getButtonTextColorConfig(),
+        footerButtonPartnerConfig.getButtonRippleColorAlphaConfig());
     FooterButtonStyleUtils.updateButtonTextSizeWithPartnerConfig(
         context, button, footerButtonPartnerConfig.getButtonTextSizeConfig());
     FooterButtonStyleUtils.updateButtonMinHeightWithPartnerConfig(
@@ -148,23 +148,6 @@
         context, button, footerButtonPartnerConfig.getButtonIconConfig(), isButtonIconAtEnd);
   }
 
-  @TargetApi(VERSION_CODES.S)
-  static void applyDynamicColorOnPrimaryButton(Context context, Button button) {
-    // only update the text color of enable state
-    if (button.isEnabled()) {
-      FooterButtonStyleUtils.updateButtonTextEnabledColor(
-          button, context.getResources().getColor(R.color.suc_system_neutral1_900));
-    }
-    FooterButtonStyleUtils.updateButtonBackgroundTintList(
-        context,
-        button,
-        context.getResources().getColor(R.color.suc_system_accent1_100),
-        /* disabledAlpha=*/ 0f,
-        /* disabledColor=*/ 0);
-    FooterButtonStyleUtils.updateButtonRippleColor(
-        button, context.getResources().getColor(R.color.suc_system_neutral1_900));
-  }
-
   static void updateButtonTextEnabledColorWithPartnerConfig(
       Context context, Button button, PartnerConfig buttonEnableTextColorConfig) {
     @ColorInt
@@ -247,38 +230,32 @@
     }
   }
 
+  @TargetApi(VERSION_CODES.Q)
   static void updateButtonRippleColorWithPartnerConfig(
       Context context,
       Button button,
+      boolean applyDynamicColor,
       PartnerConfig buttonTextColorConfig,
       PartnerConfig buttonRippleColorAlphaConfig) {
-    // RippleDrawable is available after sdk 21. And because on lower sdk the RippleDrawable is
-    // unavailable. Since Stencil customization provider only works on Q+, there is no need to
-    // perform any customization for versions 21.
     if (Build.VERSION.SDK_INT >= VERSION_CODES.LOLLIPOP) {
-      RippleDrawable rippleDrawable = getRippleDrawable(button);
-      if (rippleDrawable == null) {
-        return;
+
+      @ColorInt int textDefaultColor;
+      if (applyDynamicColor) {
+        // Get dynamic text color
+        textDefaultColor = button.getTextColors().getDefaultColor();
+      } else {
+        // Get partner text color.
+        textDefaultColor =
+            PartnerConfigHelper.get(context).getColor(context, buttonTextColorConfig);
       }
-
-      int[] pressedState = {android.R.attr.state_pressed};
-      // Get partner text color.
-      @ColorInt
-      int color = PartnerConfigHelper.get(context).getColor(context, buttonTextColorConfig);
-
       float alpha =
           PartnerConfigHelper.get(context).getFraction(context, buttonRippleColorAlphaConfig);
-
-      // Set text color for ripple.
-      ColorStateList colorStateList =
-          new ColorStateList(
-              new int[][] {pressedState, StateSet.NOTHING},
-              new int[] {convertRgbToArgb(color, alpha), Color.TRANSPARENT});
-      rippleDrawable.setColor(colorStateList);
+      updateButtonRippleColor(button, textDefaultColor, alpha);
     }
   }
 
-  static void updateButtonRippleColor(Button button, @ColorInt int rippleColor) {
+  private static void updateButtonRippleColor(
+      Button button, @ColorInt int textColor, float rippleAlpha) {
     // RippleDrawable is available after sdk 21. And because on lower sdk the RippleDrawable is
     // unavailable. Since Stencil customization provider only works on Q+, there is no need to
     // perform any customization for versions 21.
@@ -294,7 +271,7 @@
       ColorStateList colorStateList =
           new ColorStateList(
               new int[][] {pressedState, StateSet.NOTHING},
-              new int[] {rippleColor, Color.TRANSPARENT});
+              new int[] {convertRgbToArgb(textColor, rippleAlpha), Color.TRANSPARENT});
       rippleDrawable.setColor(colorStateList);
     }
   }
diff --git a/main/java/com/google/android/setupcompat/util/Logger.java b/main/java/com/google/android/setupcompat/util/Logger.java
new file mode 100644
index 0000000..3f8dfd1
--- /dev/null
+++ b/main/java/com/google/android/setupcompat/util/Logger.java
@@ -0,0 +1,83 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.google.android.setupcompat.util;
+
+import android.util.Log;
+
+/**
+ * Helper class that wraps {@link Log} to log messages to logcat. This class consolidate the log
+ * {@link #TAG} in both SetupCompat and SetupDesign library.
+ *
+ * <p>When logging verbose and debug logs, the logs should either be guarded by {@code if
+ * (logger.isV())}, or a constant if (DEBUG). That DEBUG constant should be false on any submitted
+ * code.
+ */
+public final class Logger {
+
+  public static final String TAG = "SetupLibrary";
+
+  private final String prefix;
+
+  public Logger(Class<?> cls) {
+    this(cls.getSimpleName());
+  }
+
+  public Logger(String prefix) {
+    this.prefix = "[" + prefix + "] ";
+  }
+
+  public boolean isV() {
+    return Log.isLoggable(TAG, Log.VERBOSE);
+  }
+
+  public boolean isD() {
+    return Log.isLoggable(TAG, Log.DEBUG);
+  }
+
+  public boolean isI() {
+    return Log.isLoggable(TAG, Log.INFO);
+  }
+
+  public void atVerbose(String message) {
+    if (isV()) {
+      Log.v(TAG, prefix.concat(message));
+    }
+  }
+
+  public void atDebug(String message) {
+    if (isD()) {
+      Log.d(TAG, prefix.concat(message));
+    }
+  }
+
+  public void atInfo(String message) {
+    if (isI()) {
+      Log.i(TAG, prefix.concat(message));
+    }
+  }
+
+  public void w(String message) {
+    Log.w(TAG, prefix.concat(message));
+  }
+
+  public void e(String message) {
+    Log.e(TAG, prefix.concat(message));
+  }
+
+  public void e(String message, Throwable throwable) {
+    Log.e(TAG, prefix.concat(message), throwable);
+  }
+}
diff --git a/main/java/com/google/android/setupcompat/util/SystemBarHelper.java b/main/java/com/google/android/setupcompat/util/SystemBarHelper.java
index d61ff8b..dd92501 100644
--- a/main/java/com/google/android/setupcompat/util/SystemBarHelper.java
+++ b/main/java/com/google/android/setupcompat/util/SystemBarHelper.java
@@ -24,7 +24,6 @@
 import android.os.Build.VERSION;
 import android.os.Build.VERSION_CODES;
 import android.os.Handler;
-import android.util.Log;
 import android.view.View;
 import android.view.ViewGroup;
 import android.view.Window;
@@ -44,7 +43,7 @@
  */
 public final class SystemBarHelper {
 
-  private static final String TAG = "SystemBarHelper";
+  private static final Logger LOG = new Logger("SystemBarHelper");
 
   /** Needs to be equal to View.STATUS_BAR_DISABLE_BACK */
   private static final int STATUS_BAR_DISABLE_BACK = 0x00400000;
@@ -329,7 +328,7 @@
                 // If the decor view is not installed yet, try again in the next loop.
                 handler.post(checkDecorViewRunnable);
               } else {
-                Log.w(TAG, "Cannot get decor view of window: " + window);
+                LOG.e("Cannot get decor view of window: " + window);
               }
             }
           }
diff --git a/main/res/values-v31/colors.xml b/main/res/values-v31/colors.xml
deleted file mode 100644
index da7f1e8..0000000
--- a/main/res/values-v31/colors.xml
+++ /dev/null
@@ -1,21 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-    Copyright (C) 2021 The Android Open Source Project
-
-    Licensed under the Apache License, Version 2.0 (the "License");
-    you may not use this file except in compliance with the License.
-    You may obtain a copy of the License at
-
-         http://www.apache.org/licenses/LICENSE-2.0
-
-    Unless required by applicable law or agreed to in writing, software
-    distributed under the License is distributed on an "AS IS" BASIS,
-    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-    See the License for the specific language governing permissions and
-    limitations under the License.
--->
-
-<resources>
-  <color name="suc_system_accent1_100">@android:color/system_accent1_100</color>
-  <color name="suc_system_neutral1_900">@android:color/system_neutral1_900</color>
-</resources>
\ No newline at end of file
diff --git a/main/res/values/colors.xml b/main/res/values/colors.xml
index e9f25a5..f472b35 100644
--- a/main/res/values/colors.xml
+++ b/main/res/values/colors.xml
@@ -23,7 +23,4 @@
 
     <color name="suc_customization_button_highlight_default">#ff1a73e8</color>
 
-    <color name="suc_system_accent1_100">#8DF5E3</color>
-
-    <color name="suc_system_neutral1_900">#1b1b1b</color>
 </resources>
\ No newline at end of file