Update icon tint color when the user toggles Dark theme

- Reload theme in slice provider when Dark theme mode changes for slices
- Reload theme in onCreate of Panel activity for its non-slice header
- Remove applyTheme from individual slices

Test: robotest
Fixes: 153700819
Change-Id: I40a7d2817c4b9100d7b2f2962a69c8a9ce6f7906
diff --git a/src/com/android/settings/Utils.java b/src/com/android/settings/Utils.java
index 2391fe8..d34dbcf 100644
--- a/src/com/android/settings/Utils.java
+++ b/src/com/android/settings/Utils.java
@@ -42,6 +42,7 @@
 import android.content.pm.PackageManager.NameNotFoundException;
 import android.content.pm.ResolveInfo;
 import android.content.pm.UserInfo;
+import android.content.res.Configuration;
 import android.content.res.Resources;
 import android.content.res.TypedArray;
 import android.database.Cursor;
@@ -1101,4 +1102,13 @@
                 context.getString(R.string.config_settingsintelligence_package_name));
         return isSettingsIntelligence;
     }
+
+    /**
+     * Returns true if the night mode is enabled.
+     */
+    public static boolean isNightMode(Context context) {
+        final int currentNightMode =
+                context.getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK;
+        return currentNightMode == Configuration.UI_MODE_NIGHT_YES;
+    }
 }