Removal of core locations accessibility usage 2.1b_release accepted/tizen_2.1/20130425.034736 submit/tizen_2.1/20130424.232523
authorNandan SR <nandan.sr@samsung.com>
Sun, 21 Apr 2013 09:37:43 +0000 (15:07 +0530)
committerNandan SR <nandan.sr@samsung.com>
Sun, 21 Apr 2013 09:37:43 +0000 (15:07 +0530)
Change-Id: I16016ea89f28ba877408d10ff92f876a612c2f97
Signed-off-by: Nandan SR <nandan.sr@samsung.com>
src/FLocLocationProvider.cpp
src/FLoc_LocationImpl.cpp
src/FLoc_LocationImpl.h
src/FLoc_LocationManager.cpp
src/FLoc_LocationManager.h
src/FLoc_LocationProviderImpl.cpp

index 26e8056..2ecde3e 100644 (file)
@@ -70,7 +70,7 @@ LocationProvider::StartLocationUpdatesByInterval(int interval)
 {
        result r = _AccessController::CheckUserPrivilege(_PRV_LOCATION);
        r = TransExceptionsExclusive(r, E_PRIVILEGE_DENIED, E_USER_NOT_CONSENTED);
-       SysTryReturnResult(NID_LOC, r == E_SUCCESS, r, "[%s] The application is not permitted to call this method.",GetErrorMessage(r));
+       SysTryReturnResult(NID_LOC, r == E_SUCCESS, r, "The application is not permitted to call this method.");
        SysAssertf(__pImpl != null, "Not yet constructed. Construct() should be called before use.");
 
        r = __pImpl->StartLocationUpdatesByInterval(interval);
@@ -84,7 +84,7 @@ LocationProvider::StartLocationUpdatesByDistance(double distance)
 {
        result r = _AccessController::CheckUserPrivilege(_PRV_LOCATION);
        r = TransExceptionsExclusive(r, E_PRIVILEGE_DENIED, E_USER_NOT_CONSENTED);
-       SysTryReturnResult(NID_LOC, r == E_SUCCESS, r, "[%s] The application is not permitted to call this method.",GetErrorMessage(r));
+       SysTryReturnResult(NID_LOC, r == E_SUCCESS, r, "The application is not permitted to call this method.");
        SysAssertf(__pImpl != null, "Not yet constructed. Construct() should be called before use.");
 
        r = __pImpl->StartLocationUpdatesByDistance(distance);
index 4fd8014..c152405 100644 (file)
@@ -42,7 +42,6 @@ _LocationImpl::_LocationImpl(void)
        , __verticalAccuracy(Tizen::Locations::NaN)
        , __timestamp(0)
        , __isLocationValid(false)
-       , __isDenied(false)
 {
 }
 
@@ -56,7 +55,6 @@ _LocationImpl::_LocationImpl(const _LocationImpl& rhs)
        , __locationMethod(rhs.__locationMethod)
        , __satelliteInformation(rhs.__satelliteInformation)
        , __isLocationValid(rhs.__isLocationValid)
-       , __isDenied(rhs.__isDenied)
 {
 }
 
index b38caa0..bebc30c 100644 (file)
@@ -149,16 +149,6 @@ public:
        //
        long long GetTimestampInMs(void){return __timestamp;}
 
-       //
-       // Turns on the denied flag.
-       //
-       void TurnOnDeniedFlag(void) {__isDenied = true;}
-
-       //
-       // Returns the denied flag.
-       //
-       bool IsDenied(void) {return __isDenied;}
-
        /**
         *      Gets the Impl instance of the given %Location object
         */
@@ -199,7 +189,6 @@ private:
        Tizen::Base::String __locationMethod;
        Tizen::Base::String __satelliteInformation;
        bool __isLocationValid;
-       bool __isDenied;
 };  // _LocationImpl
 } } // Tizen::Location
 #endif  // _FLOC_INTERNAL_LOCATION_IMPL_H_
index 686aa4d..71e518c 100644 (file)
@@ -264,45 +264,6 @@ _LocationManager::GetAccuracyLevel(double horAcc) const
        }
 }
 
-bool
-_LocationManager::IsAppEnabled(void)
-{
-       SysTryReturn(NID_LOC, __waitLoopListener.GetValue(), false, E_SYSTEM, "[%s] Location manager is not initialized.", GetErrorMessage(E_SYSTEM));
-
-       Boolean enable(false);
-       Monitor synchronizer;
-       result r = synchronizer.Construct();
-       SysTryReturn(NID_LOC, r == E_SUCCESS, false, r, "[%s] Propogating.", GetErrorMessage(r));
-
-       std::unique_ptr< Tizen::Base::Collection::ArrayList > pArgList(new (std::nothrow) ArrayList());
-       SysTryReturn(NID_LOC, pArgList, false, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
-       r = pArgList->Construct();
-       SysTryReturn(NID_LOC, r == E_SUCCESS, false, r, "[%s] Propogating.", GetErrorMessage(r));
-
-       r = pArgList->Add(enable);
-       SysTryCatch(NID_LOC, r == E_SUCCESS, , r, "[%s] Propogating", GetErrorMessage(r));
-       r = pArgList->Add(synchronizer);
-       SysTryCatch(NID_LOC, r == E_SUCCESS, , r, "[%s] Propogating", GetErrorMessage(r));
-
-       r = synchronizer.Enter();
-       SysTryCatch(NID_LOC, r == E_SUCCESS, , r, "[%s] Propogating", GetErrorMessage(r));
-
-       r = SendUserEvent(REQ_ID_GET_APP_ACCESSIBILITY, pArgList.get());
-       SysTryCatch(NID_LOC, r == E_SUCCESS, synchronizer.Exit(), r, "[%s] Propogating", GetErrorMessage(r));
-       pArgList.release();
-
-       SysLog(NID_LOC, "Wait till location manager checks if the app is allowed to use location.");
-       r = synchronizer.Wait();
-       SysTryCatch(NID_LOC, r == E_SUCCESS, synchronizer.Exit(), r, "[%s] Propogating", GetErrorMessage(r));
-       SysLog(NID_LOC, "Application setting state is '%ls'.", enable.ToString().GetPointer());
-       synchronizer.Exit();
-
-       return enable.ToBool();
-
-CATCH:
-       return false;
-}
-
 _LocationManager*
 _LocationManager::GetInstance(void)
 {
@@ -693,10 +654,9 @@ _LocationManager::SetLocationInformation(double latitude, double longitude, doub
 void
 _LocationManager::SendLocationCallbacks(void)
 {
-       bool isAllowed = GetAppAccessibility();
        const Location* pBestLocation = FindBestLocation();
 
-       SysLog(NID_LOC, "Send location(validity: %x) and accessibility(%x) through the callback.", pBestLocation->IsValid(), isAllowed);
+       SysLog(NID_LOC, "Send location(validity: %x) through the callback.", pBestLocation->IsValid());
        unique_ptr< Location > pLocation(new (std::nothrow) Location(*pBestLocation));
        SysTryReturnVoidResult(NID_LOC, pLocation != null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
 
@@ -706,10 +666,6 @@ _LocationManager::SendLocationCallbacks(void)
                const _LocationRequestInfo* pLocRequestInfo = static_cast< const _LocationRequestInfo* >(__pLocRequestInfoList->GetAt(i));
                if (interval % pLocRequestInfo->GetInterval() == 0 && pLocRequestInfo->GetListener() != null)
                {
-                       if (!isAllowed)
-                       {
-                               _LocationImpl::GetInstance(*pLocation)->TurnOnDeniedFlag();
-                       }
                        pLocRequestInfo->GetListener()->OnLocationUpdated(pLocRequestInfo->GetRequestId(), *pLocation.get());
                }
        }
@@ -902,11 +858,11 @@ _LocationManager::FindBestLocation(void)
                long long gpsTimestamp = 0;
                long long wpsTimestamp = 0;
 
-               if (__gpsHandler.pLocation->IsValid() && !_LocationImpl::GetInstance(*__gpsHandler.pLocation)->IsDenied())
+               if (__gpsHandler.pLocation->IsValid())
                {
                        gpsTimestamp = _LocationImpl::GetInstance(*__gpsHandler.pLocation)->GetTimestampInMs();
                }
-               if (__wpsHandler.pLocation->IsValid() && !_LocationImpl::GetInstance(*__wpsHandler.pLocation)->IsDenied())
+               if (__wpsHandler.pLocation->IsValid())
                {
                        wpsTimestamp = _LocationImpl::GetInstance(*__wpsHandler.pLocation)->GetTimestampInMs();
                }
@@ -1160,29 +1116,6 @@ _LocationManager::OnUserEventReceivedN(RequestId requestId, IList* pArgs)
        }
        break;
 
-       case REQ_ID_GET_APP_ACCESSIBILITY:
-       {
-               SysLog(NID_LOC, "REQ_ID_GET_APP_ACCESSIBILITY");
-               SysTryReturnVoidResult(NID_LOC, pArgs, E_INVALID_ARG, "[E_INVALID_ARG] Null argument encountered. Ignored.");
-
-               Boolean* pEnabled = static_cast< Boolean* >(pArgs->GetAt(0));
-               Monitor* pMonitor = static_cast< Monitor* >(pArgs->GetAt(1));
-               SysAssertf(pEnabled != null && pMonitor != null, "Invalid request has been made on the location manager.");
-               if (pMonitor != null)
-               {
-                       pMonitor->Enter();
-                       if (pEnabled != null)
-                       {
-                               pEnabled->value = GetAppAccessibility();
-                       }
-                       pMonitor->Notify();
-                       pMonitor->Exit();
-               }
-               pArgs->RemoveAt(1);
-               pArgs->RemoveAt(0);
-       }
-       break;
-
        case REQ_ID_GET_LAST_LOCATION:
        {
                SysLog(NID_LOC, "REQ_ID_GET_LAST_LOCATION");
@@ -1391,29 +1324,4 @@ _LocationManager::DestroyLocationManager(void)
        delete __pUniqueInstance;
 }
 
-bool
-_LocationManager::GetAppAccessibility(void)
-{
-       int res = 0;
-       static bool appRegistered = false;
-       if (!appRegistered)
-       {
-               static const char COMMAND_REGISTER_APP[] = "ADD_APPLIST";
-               if (location_manager_send_command(COMMAND_REGISTER_APP) == LOCATIONS_ERROR_NONE)
-               {
-                       static const char COMMAND_ENABLE_APP[] = "ACCESSIBILITY:1";
-                       res = location_manager_send_command(COMMAND_ENABLE_APP);
-                       SysTryReturn(NID_LOC, res == 0, false, E_SYSTEM,
-                                                "[%s] Failed to register the application.", GetErrorMessage(E_SYSTEM));
-                       appRegistered = true;
-               }
-       }
-
-       location_accessibility_state_e accessState;
-       res = location_manager_get_accessibility_state(&accessState);
-       SysTryReturn(NID_LOC, res == 0, false, E_SYSTEM,
-                                "[%s] Failed to get the application location setting.", GetErrorMessage(E_SYSTEM));
-
-       return (accessState == LOCATIONS_ACCESS_STATE_ALLOWED) ? true : false;
-}
 }}
index 4a75f71..2c2322a 100644 (file)
@@ -82,12 +82,6 @@ public:
        //
        LocationAccuracy GetAccuracyLevel(double horAcc) const;
 
-       // This method gets the location setting information of this particular application.
-       //
-       // @since 2.0
-       //
-       bool IsAppEnabled(void);
-
        // This method returns the wait loop listener of this class.
        //
        // @since 2.0
@@ -275,13 +269,6 @@ private:
        //
        static void DestroyLocationManager(void);
 
-       // This method gets app's accessibility from native side, adding the app into the location
-       // setting, if it is not registerd.
-       //
-       // @since 2.0
-       //
-       static bool GetAppAccessibility(void);
-
 private:
        const static RequestId REQ_ID_START_LOC_UPDATES = 1;
        const static RequestId REQ_ID_STOP_LOC_UPDATES = 2;
@@ -289,9 +276,8 @@ private:
        const static RequestId REQ_ID_SUSTAIN_GPS = 4;
        const static RequestId REQ_ID_SUSTAIN_WPS = 5;
        const static RequestId REQ_ID_SYNC_LOC_RETRIEVAL = 6;
-       const static RequestId REQ_ID_GET_APP_ACCESSIBILITY = 7;
-       const static RequestId REQ_ID_GET_LAST_LOCATION = 8;
-       const static RequestId REQ_ID_UPDATE_INTERVAL = 9;
+       const static RequestId REQ_ID_GET_LAST_LOCATION = 7;
+       const static RequestId REQ_ID_UPDATE_INTERVAL = 8;
 
        enum _LocationMethodRequested
        {
index 2bf3725..f88e03b 100644 (file)
@@ -680,7 +680,7 @@ _LocationProviderImpl::HandleLocationUpdate(Tizen::Locations::Location& location
                        newLocationUpdateStatus = LOC_SVC_STATUS_RUNNING;
                }
        }
-       else if (_LocationImpl::GetInstance(location)->IsDenied())
+       else if (!GetUserPrivilege())
        {
                SysLog(NID_LOC, "User consent not available.");
                if (__locationUpdater.type != _LOCATION_UPDATE_TYPE_NONE && __locationUpdater.status != LOC_SVC_STATUS_PAUSED)
@@ -733,7 +733,7 @@ _LocationProviderImpl::HandleRegionMonitoring(Tizen::Locations::Location& locati
        {
                newRegionMonitorStatus = LOC_SVC_STATUS_RUNNING;
        }
-       else if (_LocationImpl::GetInstance(location)->IsDenied())
+       else if (!GetUserPrivilege())
        {
                newRegionMonitorStatus = LOC_SVC_STATUS_DENIED;
        }
@@ -904,15 +904,6 @@ _LocationProviderImpl::NotifyServiceStatus(_LocProviderEventType eventType, Loca
 bool
 _LocationProviderImpl::GetUserPrivilege(void)
 {
-       _LocationManager* pLocMgr = _LocationManager::GetInstance();
-       SysTryReturn(NID_LOC, pLocMgr, false, E_SYSTEM, "[E_SYSTEM] Failed to get the location manager instance.");
-
-       bool appSettingEnabled = pLocMgr->IsAppEnabled();
-       if (appSettingEnabled == false)
-       {
-               return false;
-       }
-
        bool hasPrivilege = false;
        bool gpsEnabled = true;
        bool wpsEnabled = true;