Check-gl: Add pop-up message when launch emulator.(only in Ubuntu)
authorminkee.lee <minkee.lee@samsung.com>
Wed, 29 Oct 2014 05:33:48 +0000 (14:33 +0900)
committerminkee.lee <minkee.lee@samsung.com>
Wed, 29 Oct 2014 07:11:15 +0000 (16:11 +0900)
- If host's graphic driver is invalid for emulator,(gallium driver)
  pop-up is shown when user launchs emulator.
  Then, user can select whether continue or stop launching.

Change-Id: I4e5b60b4ffe251b08b1f03d8d09a8989810b53c2
Signed-off-by: minkee.lee <minkee.lee@samsung.com>
common-project/src/org/tizen/emulator/manager/tool/CheckVirtualization.java
common-project/src/org/tizen/emulator/manager/ui/dialog/MessageDialog.java
common-project/src/org/tizen/emulator/manager/vms/VMWorkerCommon.java

index e15d37c..8c42e70 100644 (file)
@@ -57,6 +57,8 @@ public class CheckVirtualization {
        private static String GPU_disable_command       = null;
 
        private static boolean isCheck = false;
+       private static boolean isGallium = false; // for ubuntu OS
+
 
        private CheckVirtualization() {
                // singleton class
@@ -74,6 +76,10 @@ public class CheckVirtualization {
                return isGPUSupport;
        }
 
+       public boolean isGallium() {
+               return isGallium;
+       }
+
        public String getVirtualizationEnableCommnad() {
                return virtualization_enable_command;
        }
@@ -211,8 +217,13 @@ public class CheckVirtualization {
                                EMLogger.getLogger().log(Level.WARNING, "Exception" + e.getMessage());
                        }
 
-                       if(exitValue == 0) {
+                       if( exitValue == 0) {
                                isGPUSupport = true;
+
+                       } else if (exitValue == 2) {
+                               isGPUSupport = true;
+                               isGallium = true;
+
                        } else {
                                GPU_enable_command = "";
                                isGPUSupport = false;
index e87d1df..ccc28f8 100644 (file)
@@ -84,6 +84,10 @@ public class MessageDialog
                return openMessageDialog(title, message,  SWT.ICON_QUESTION, SWT.OK | SWT.CANCEL);
        }
 
+       public int openWarningAndSelectionDialog(final String message) {
+               return openMessageDialog("Emulator Manager", message,  SWT.ICON_WARNING, SWT.OK | SWT.CANCEL);
+       }
+
        public int openRemoveVMFailDialog(final String path, final String vmName) {
                msgResponse = 0;
                return openRemoveVMFailDialog("Emulator Manager", path, vmName, SWT.ICON_WARNING, SWT.OK);
index 836367c..08637dc 100644 (file)
@@ -38,11 +38,14 @@ import java.util.ArrayList;
 import java.util.List;
 import java.util.logging.Level;
 
+import org.eclipse.swt.SWT;
 import org.tizen.emulator.manager.EmulatorManager;
 import org.tizen.emulator.manager.logging.EMLogger;
 import org.tizen.emulator.manager.resources.FilePathResources;
 import org.tizen.emulator.manager.resources.StringResources;
+import org.tizen.emulator.manager.tool.CheckVirtualization;
 import org.tizen.emulator.manager.ui.VMsMainView;
+import org.tizen.emulator.manager.ui.dialog.MessageDialog;
 import org.tizen.emulator.manager.vms.helper.CheckingRunningEmulator;
 import org.tizen.emulator.manager.vms.helper.QemuImgProc;
 import org.tizen.emulator.manager.vms.helper.VMLauncherException;
@@ -124,6 +127,27 @@ public class VMWorkerCommon {
                                                }
                                        }
 
+                                       // Check graphic driver (only in linux)
+                                       if (EmulatorManager.isLinux() && CheckVirtualization.getInstance().isGallium()
+                                                       && property.getPropertyValue().isGLAcceleration) {
+                                               // show [ok/cancel] message.
+                                               MessageDialog dialog = new MessageDialog();
+                                               int response = dialog.openWarningAndSelectionDialog(
+                                                               "\n You are using invalid graphic card driver for the emulator."
+                                                               + "\n If you continue launching emulator, it may not work properly."
+
+                                                               + "\n\n You have to use the lastest vendor-provided graphic card driver."
+                                                               + "\n For more information, see under ubuntu driver help page."
+                                                               + "\n https://help.ubuntu.com/community/BinaryDriverHowto/ "
+
+                                                               + "\n\n Do you want to continue launching emulator?"
+                                                               + "\n (If you set GPU support \"off\", you can avoid this message.)"
+                                                               );
+                                               if (response != SWT.OK) {
+                                                       throw new VMWorkerException("User stops launching emulator.");
+                                               }
+                                       }
+
                                        isRunningNow();
 
                                        if (!launcher.launch(property, wait)) {