Make dialog change with dark theme
Bug: 171673897
Test: build and UI test.
Change-Id: I609de571ad08e235963a8bf967cb6ded3f8ec605
diff --git a/service/java/com/android/server/wifi/FrameworkFacade.java b/service/java/com/android/server/wifi/FrameworkFacade.java
index d80109e..d4cdcf3 100644
--- a/service/java/com/android/server/wifi/FrameworkFacade.java
+++ b/service/java/com/android/server/wifi/FrameworkFacade.java
@@ -30,6 +30,7 @@
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
+import android.content.res.Configuration;
import android.database.ContentObserver;
import android.net.TrafficStats;
import android.net.Uri;
@@ -266,7 +267,10 @@
* @return an instance of AlertDialog.Builder
*/
public AlertDialog.Builder makeAlertDialogBuilder(Context context) {
- return new AlertDialog.Builder(context);
+ boolean isDarkTheme = (context.getResources().getConfiguration().uiMode
+ & Configuration.UI_MODE_NIGHT_MASK) == Configuration.UI_MODE_NIGHT_YES;
+ return new AlertDialog.Builder(context, isDarkTheme
+ ? android.R.style.Theme_DeviceDefault_Dialog_Alert : 0);
}
/**