Enabling wifi on new demo session

A customer may switch off wifi in a retail environment, which will lead
to no internet connectivity in the following sessions, which is not
desirable. Fixing it by enabling wifi at the beginning of every new demo
session.

Bug: 31689469
Change-Id: Ie7eb17bfe8fbee185d5bfe6ac7a590ca5dabdc29
diff --git a/services/retaildemo/java/com/android/server/retaildemo/RetailDemoModeService.java b/services/retaildemo/java/com/android/server/retaildemo/RetailDemoModeService.java
index 6b27321..6197c42 100644
--- a/services/retaildemo/java/com/android/server/retaildemo/RetailDemoModeService.java
+++ b/services/retaildemo/java/com/android/server/retaildemo/RetailDemoModeService.java
@@ -44,6 +44,7 @@
 import android.media.AudioManager;
 import android.media.AudioSystem;
 import android.net.Uri;
+import android.net.wifi.WifiManager;
 import android.os.Environment;
 import android.os.FileUtils;
 import android.os.Handler;
@@ -117,6 +118,7 @@
     private ServiceThread mHandlerThread;
     private PendingIntent mResetDemoPendingIntent;
     private CameraManager mCameraManager;
+    private WifiManager mWifiManager;
     private String[] mCameraIdsWithFlash;
     private Configuration mSystemUserConfiguration;
     private PreloadAppsInstaller mPreloadAppsInstaller;
@@ -491,6 +493,7 @@
                                 PowerManager.FULL_WAKE_LOCK | PowerManager.ACQUIRE_CAUSES_WAKEUP,
                                 TAG);
                 mNm = NotificationManager.from(getContext());
+                mWifiManager = (WifiManager) getContext().getSystemService(Context.WIFI_SERVICE);
                 mCameraManager = (CameraManager) getContext()
                         .getSystemService(Context.CAMERA_SERVICE);
                 mCameraIdsWithFlash = getCameraIdsWithFlash();
@@ -528,6 +531,9 @@
         mAmi.updatePersistentConfigurationForUser(getSystemUsersConfiguration(), userId);
         turnOffAllFlashLights();
         muteVolumeStreams();
+        if (!mWifiManager.isWifiEnabled()) {
+            mWifiManager.setWifiEnabled(true);
+        }
         // Disable lock screen for demo users.
         LockPatternUtils lockPatternUtils = new LockPatternUtils(getContext());
         lockPatternUtils.setLockScreenDisabled(true, userId);