private static void CreateManifest(string manifestPath, string companyName, string productName, string normalizedProductName, string id, AssemblyReferenceChecker checker)
 {
     string validVersionString = GetValidVersionString();
     TextWriter writer = new StreamWriter(manifestPath);
     writer.WriteLine("<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\"?>");
     writer.WriteLine("<manifest xmlns=\"http://tizen.org/ns/packages\" api-version=\"" + TizenUtilities.StringFromMinOSVersion() + "\" package=\"" + id + "\" version=\"" + validVersionString + "\">");
     writer.WriteLine("    <author href=\"" + PlayerSettings.Tizen.productURL + "\">" + companyName + "</author>");
     writer.WriteLine("   <profile name=\"mobile\" />");
     writer.WriteLine("\t<description>" + SecurityElement.Escape(PlayerSettings.Tizen.productDescription) + "</description>");
     writer.WriteLine("\t<ui-application appid=\"" + id + "\" exec=\"" + normalizedProductName + "\" type=\"capp\" multiple=\"false\" taskmanage=\"true\" nodisplay=\"false\">");
     writer.WriteLine("\t\t<icon>app_icon.png</icon>");
     writer.WriteLine("\t\t<label>" + productName + "</label>");
     writer.WriteLine("\t</ui-application>");
     writer.WriteLine("\t<feature name=\"http://tizen.org/feature/screen.size.all\">true</feature>");
     writer.WriteLine("\t<privileges>");
     if (checker.HasReferenceToMethod("UnityEngine.Handheld::Vibrate") || checker.HasReferenceToMethod("UnityEngine.iPhoneUtils::Vibrate"))
     {
         writer.WriteLine("\t\t<privilege>http://tizen.org/privilege/haptic</privilege>");
     }
     if (checker.HasReferenceToType("UnityEngine.WebCamTexture"))
     {
         writer.WriteLine("\t\t<privilege>http://tizen.org/privilege/camera</privilege>");
     }
     if (checker.HasReferenceToMethod("UnityEngine.Application::OpenURL") || checker.HasReferenceToType("UnityEngine.Purchasing"))
     {
         writer.WriteLine("\t\t<privilege>http://tizen.org/privilege/appmanager.launch</privilege>");
     }
     if (checker.HasReferenceToType("UnityEngine.SystemInfo") && (PlayerSettings.Tizen.minOSVersion == TizenOSVersion.Version23))
     {
         writer.WriteLine("\t\t<privilege>http://tizen.org/privilege/systemsettings</privilege>");
     }
     if (checker.HasReferenceToMethod("UnityEngine.Screen::set_sleepTimeout"))
     {
         writer.WriteLine("\t\t<privilege>http://tizen.org/privilege/display</privilege>");
     }
     if (((checker.HasReferenceToType("UnityEngine.Networking") || checker.HasReferenceToType("System.Net.Sockets")) || (checker.HasReferenceToType("UnityEngine.Network") || checker.HasReferenceToType("UnityEngine.RPC"))) || (checker.HasReferenceToType("UnityEngine.WWW") || checker.HasReferenceToType(typeof(UnityWebRequest).FullName)))
     {
         writer.WriteLine("\t\t<privilege>http://tizen.org/privilege/internet</privilege>");
     }
     TizenUtilities.WriteCapabilitiesToManifest(writer);
     writer.WriteLine("\t</privileges>");
     writer.WriteLine("</manifest>");
     writer.Close();
     string[] source = File.ReadAllLines(manifestPath);
     File.WriteAllLines(manifestPath, Enumerable.ToArray<string>(Enumerable.Distinct<string>(source)));
 }
예제 #2
0
 private bool doesReferenceNetworkClasses(AssemblyReferenceChecker checker)
 {
     return ((((checker.HasReferenceToType("UnityEngine.Networking") || checker.HasReferenceToType("System.Net.Sockets")) || (checker.HasReferenceToType("UnityEngine.Network") || checker.HasReferenceToType("UnityEngine.RPC"))) || (checker.HasReferenceToType("UnityEngine.WWW") || checker.HasReferenceToType(typeof(Ping).FullName))) || checker.HasReferenceToType(typeof(UnityWebRequest).FullName));
 }
예제 #3
0
 private void SetPermissionAttributes(PostProcessorContext context, AndroidManifest manifestXML, AssemblyReferenceChecker checker)
 {
     if ((this._developmentPlayer || PlayerSettings.Android.forceInternetPermission) || this.doesReferenceNetworkClasses(checker))
     {
         manifestXML.AddUsesPermission("android.permission.INTERNET");
     }
     if (checker.HasReferenceToMethod("UnityEngine.Handheld::Vibrate"))
     {
         manifestXML.AddUsesPermission("android.permission.VIBRATE");
     }
     if (checker.HasReferenceToMethod("UnityEngine.iPhoneSettings::get_internetReachability") || checker.HasReferenceToMethod("UnityEngine.Application::get_internetReachability"))
     {
         manifestXML.AddUsesPermission("android.permission.ACCESS_NETWORK_STATE");
     }
     if (((checker.HasReferenceToMethod("UnityEngine.Input::get_location") || checker.HasReferenceToMethod("UnityEngine.iPhoneInput::get_lastLocation")) || (checker.HasReferenceToMethod("UnityEngine.iPhoneSettings::get_locationServiceStatus") || checker.HasReferenceToMethod("UnityEngine.iPhoneSettings::get_locationServiceEnabledByUser"))) || (checker.HasReferenceToMethod("UnityEngine.iPhoneSettings::StartLocationServiceUpdates") || checker.HasReferenceToMethod("UnityEngine.iPhoneSettings::StopLocationServiceUpdates")))
     {
         manifestXML.AddUsesPermission("android.permission.ACCESS_FINE_LOCATION");
         manifestXML.AddUsesFeature("android.hardware.location.gps", false);
         manifestXML.AddUsesFeature("android.hardware.location", false);
     }
     if (checker.HasReferenceToType("UnityEngine.WebCamTexture"))
     {
         manifestXML.AddUsesPermission("android.permission.CAMERA");
         manifestXML.AddUsesFeature("android.hardware.camera", false);
         manifestXML.AddUsesFeature("android.hardware.camera.autofocus", false);
         manifestXML.AddUsesFeature("android.hardware.camera.front", false);
     }
     if (checker.HasReferenceToType("UnityEngine.Microphone"))
     {
         manifestXML.AddUsesPermission("android.permission.RECORD_AUDIO");
         manifestXML.AddUsesFeature("android.hardware.microphone", false);
     }
     if (PlayerSettings.Android.forceSDCardPermission)
     {
         manifestXML.AddUsesPermission("android.permission.WRITE_EXTERNAL_STORAGE");
     }
     else if (this._developmentPlayer)
     {
         manifestXML.AddUsesPermission("android.permission.WRITE_EXTERNAL_STORAGE", 0x12);
         manifestXML.AddUsesPermission("android.permission.READ_EXTERNAL_STORAGE", 0x12);
     }
     if ((checker.HasReferenceToMethod("UnityEngine.Input::get_acceleration") || checker.HasReferenceToMethod("UnityEngine.Input::GetAccelerationEvent")) || (checker.HasReferenceToMethod("UnityEngine.Input::get_accelerationEvents") || checker.HasReferenceToMethod("UnityEngine.Input::get_accelerationEventCount")))
     {
         manifestXML.AddUsesFeature("android.hardware.sensor.accelerometer", false);
     }
     manifestXML.AddUsesFeature("android.hardware.touchscreen", false);
     if (((checker.HasReferenceToMethod("UnityEngine.Input::get_touches") || checker.HasReferenceToMethod("UnityEngine.Input::GetTouch")) || (checker.HasReferenceToMethod("UnityEngine.Input::get_touchCount") || checker.HasReferenceToMethod("UnityEngine.Input::get_multiTouchEnabled"))) || (((checker.HasReferenceToMethod("UnityEngine.Input::set_multiTouchEnabled") || checker.HasReferenceToMethod("UnityEngine.iPhoneInput::get_touches")) || (checker.HasReferenceToMethod("UnityEngine.iPhoneInput::GetTouch") || checker.HasReferenceToMethod("UnityEngine.iPhoneInput::get_touchCount"))) || (checker.HasReferenceToMethod("UnityEngine.iPhoneInput::get_multiTouchEnabled") || checker.HasReferenceToMethod("UnityEngine.iPhoneInput::set_multiTouchEnabled"))))
     {
         manifestXML.AddUsesFeature("android.hardware.touchscreen.multitouch", false);
         manifestXML.AddUsesFeature("android.hardware.touchscreen.multitouch.distinct", false);
     }
     if ((checker.HasReferenceToMethod("UnityEngine.iPhoneInput::get_acceleration") || checker.HasReferenceToMethod("UnityEngine.iPhoneInput::GetAccelerationEvent")) || (checker.HasReferenceToMethod("UnityEngine.iPhoneInput::get_accelerationEvents") || checker.HasReferenceToMethod("UnityEngine.iPhoneInput::get_accelerationEventCount")))
     {
         manifestXML.AddUsesFeature("android.hardware.sensor.accelerometer", false);
     }
     if (checker.HasReferenceToMethod("UnityEngine.iPhoneUtils::Vibrate"))
     {
         manifestXML.AddUsesPermission("android.permission.VIBRATE");
     }
 }