Ejemplo n.º 1
0
        private void closeAnInstance(string instanceId)
        {
            // Native part of application is being deactivated.
            if (this.mSapaService != null && this.mProcessorList != null && this.mProcessorList.Count > 0)
            {
                SapaProcessor processor = this.mProcessorList[instanceId];
                if (processor != null)
                {
                    processor.deactivate();
                    mSapaService.unregister(processor);
                    mProcessorList.Remove(instanceId);
                }
            }

            if (this.mAppInfoList != null && this.mAppInfoList.Count > 0)
            {
                SapaAppInfo sapaAppInfo = this.mAppInfoList[instanceId];
                if (sapaAppInfo != null && sapaAppInfo.App != null)
                {
                    try
                    {
                        // Application needs to declare that its instance was
                        // successfully deactivated.
                        mSapaAppService.removeFromActiveApps(sapaAppInfo.App);
                        mAppInfoList.Remove(instanceId);
                    }
                    catch (SapaConnectionNotSetException e)
                    {
                        Log.e(TAG, "Instance could not be removed from active list because of connection exception.");
                    }
                }
            }
            mCallerPackageNameList.Remove(instanceId);
            mActionsList.Remove(instanceId);
        }
Ejemplo n.º 2
0
 private void handleDeactivationIntent(Intent intent)
 {
     lock (this)
     {
         SapaApp sapaApp = SapaAppInfo.getApp(intent);
         this.mActionsList.Remove(sapaApp.InstanceId);
         foreach (KeyValuePair <string, SapaProcessor> entry in this.mProcessorList.SetOfKeyValuePairs())
         {
             Log.d(TAG, "kakakaka " + entry.Key + " -> " + entry.Value);
         }
         SapaProcessor processor = this.mProcessorList[sapaApp.InstanceId];
         Log.d(TAG, "kakakaka instanceId " + sapaApp.InstanceId + " processor " + processor);
         processor.deactivate();
         this.mSapaService.unregister(this.mProcessorList[sapaApp.InstanceId]);
         this.mProcessorList.Remove(sapaApp.InstanceId);
         try
         {
             this.mSapaAppService.removeFromActiveApps(sapaApp);
         }
         catch (SapaConnectionNotSetException e)
         {
             Log.e(TAG, "Instance could not be removed from active list because of connection exception.");
         }
         this.mAppInfoList.Remove(sapaApp.InstanceId);
     }
 }
Ejemplo n.º 3
0
        public override void onDestroy()
        {
            Log.d(TAG, "onDestroy");

            //Native part of application is being deactivated.
            if (mSapaService != null && mSapaProcessor != null)
            {
                mSapaProcessor.deactivate();
                mSapaService.unregister(mSapaProcessor);
                this.mSapaProcessor = null;
            }

            if (this.mSapaAppService != null)
            {
                try
                {
                    if (this.mMyInfo != null && this.mMyInfo.App != null)
                    {
                        //Application needs to declare that it was successfully deactivated.
                        this.mSapaAppService.removeFromActiveApps(this.mMyInfo.App);
                    }

                    //Action definer is being removed.
                    this.mSapaAppService.removeActionDefiner();
                }
                catch (SapaConnectionNotSetException e)
                {
                    Log.e(TAG, "Instance could not be removed from active list because of connection exception.");
                }
                //Connection with remote service is finished.
                this.mSapaAppService.disconnect();
                this.mSapaAppService = null;
            }

            this.mMyInfo = null;


            base.onDestroy();
        }
Ejemplo n.º 4
0
 private void handleDeactivationIntent(Intent intent)
 {
     lock (this)
     {
         SapaApp sapaApp = SapaAppInfo.getApp(intent);
         this.mActionsList.Remove(sapaApp.InstanceId);
         SapaProcessor processor = this.mProcessorList[sapaApp.InstanceId];
         if (processor != null)
         {
             processor.deactivate();
             this.mSapaService.unregister(processor);
         }
         this.mProcessorList.Remove(sapaApp.InstanceId);
         try
         {
             this.mSapaAppService.removeFromActiveApps(sapaApp);
         }
         catch (SapaConnectionNotSetException e)
         {
             Log.e(TAG, "Instance could not be removed from active list because of connection exception.");
         }
         this.mAppInfoList.Remove(sapaApp.InstanceId);
     }
 }