Android Open Source - PhoneProfiles_Eclipse Execute Radio Profile Prefs Service






From Project

Back to project page PhoneProfiles_Eclipse.

License

The source code is released under:

Apache License

If you think the Android project PhoneProfiles_Eclipse listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package sk.henrichg.phoneprofiles;
//from  w  ww . j  a  va2 s.co  m
import android.app.IntentService;
import android.content.Context;
import android.content.Intent;

public class ExecuteRadioProfilePrefsService extends IntentService //WakefulIntentService 
{
  
  public static final String  PPHELPER_ACTION_SETPROFILEPREFERENCES = "sk.henrichg.phoneprofileshelper.ACTION_SETPROFILEPREFERENCES";

  private static final String PPHELPER_PROCEDURE = "procedure";
  private static final String PPHELPER_PROCEDURE_RADIO_CHANGE = "radioChange";
  private static final String PPHELPER_GPS_CHANGE = "GPSChange";
  private static final String PPHELPER_AIRPLANE_MODE_CHANGE = "airplaneModeChange";
  private static final String PPHELPER_NFC_CHANGE = "NFCChange";
  private static final String PPHELPER_WIFI_CHANGE = "WiFiChange";
  private static final String PPHELPER_BLUETOOTH_CHANGE = "bluetoothChange";
  private static final String PPHELPER_MOBILE_DATA_CHANGE = "mobileDataChange";
  
  
  public ExecuteRadioProfilePrefsService() {
    super("ExecuteRadioProfilePrefsService");
  }

  @Override
  public void onCreate() {
    super.onCreate();
  }

  //@Override
  //protected void doWakefulWork(Intent intent) {
  protected void onHandleIntent(Intent intent) {
    
    //Log.e("ExecuteRadioProfilePrefsService.onHandleIntent", "xxx");
    
    Context context = getBaseContext();
    
    GlobalData.loadPreferences(context);

    DataWrapper dataWrapper = new DataWrapper(context, false, false, 0);
    
    long profile_id = intent.getLongExtra(GlobalData.EXTRA_PROFILE_ID, 0);
    Profile profile = dataWrapper.getProfileById(profile_id);
    
    if (PhoneProfilesHelper.isPPHelperInstalled(context, 0))
    {
      // broadcast PPHelper
      Intent ppHelperIntent = new Intent();
      ppHelperIntent.setAction(PPHELPER_ACTION_SETPROFILEPREFERENCES);
      ppHelperIntent.putExtra(PPHELPER_PROCEDURE, PPHELPER_PROCEDURE_RADIO_CHANGE);
      ppHelperIntent.putExtra(PPHELPER_GPS_CHANGE, profile._deviceGPS);
      ppHelperIntent.putExtra(PPHELPER_AIRPLANE_MODE_CHANGE, profile._deviceAirplaneMode);
      ppHelperIntent.putExtra(PPHELPER_NFC_CHANGE, profile._deviceNFC);
      ppHelperIntent.putExtra(PPHELPER_WIFI_CHANGE, profile._deviceWiFi);
      ppHelperIntent.putExtra(PPHELPER_BLUETOOTH_CHANGE, profile._deviceBluetooth);
      ppHelperIntent.putExtra(PPHELPER_MOBILE_DATA_CHANGE, profile._deviceMobileData);
        context.sendBroadcast(ppHelperIntent);
    }
    else
    {
      // run execute radios from ActivateProfileHelper
      profile = GlobalData.getMappedProfile(profile, context);
      //profile = dataWrapper.filterProfileWithBatteryEvents(profile);
      if (profile != null)
      {
        ActivateProfileHelper aph = dataWrapper.getActivateProfileHelper();
        aph.initialize(null, context);
        aph.executeForRadios(profile);
        aph = null;
      }
    }

    dataWrapper.invalidateDataWrapper();
    dataWrapper = null;
    
  }
  
}




Java Source Code List

sk.henrichg.phoneprofiles.ActivateProfileActivity.java
sk.henrichg.phoneprofiles.ActivateProfileHelper.java
sk.henrichg.phoneprofiles.ActivateProfileListAdapter.java
sk.henrichg.phoneprofiles.ActivateProfileListFragment.java
sk.henrichg.phoneprofiles.ApplicationsCache.java
sk.henrichg.phoneprofiles.ApplicationsPreferenceAdapter.java
sk.henrichg.phoneprofiles.ApplicationsPreferenceDialog.java
sk.henrichg.phoneprofiles.ApplicationsPreference.java
sk.henrichg.phoneprofiles.BackgroundActivateProfileActivity.java
sk.henrichg.phoneprofiles.BitmapManipulator.java
sk.henrichg.phoneprofiles.BootUpReceiver.java
sk.henrichg.phoneprofiles.BrightnessDialogPreference.java
sk.henrichg.phoneprofiles.BrightnessView.java
sk.henrichg.phoneprofiles.DashClockBroadcastReceiver.java
sk.henrichg.phoneprofiles.DataWrapper.java
sk.henrichg.phoneprofiles.DatabaseHandler.java
sk.henrichg.phoneprofiles.EditorProfileListAdapter.java
sk.henrichg.phoneprofiles.EditorProfileListFragment.java
sk.henrichg.phoneprofiles.EditorProfilesActivity.java
sk.henrichg.phoneprofiles.ExecuteRadioProfilePrefsService.java
sk.henrichg.phoneprofiles.ExecuteVolumeProfilePrefsService.java
sk.henrichg.phoneprofiles.FirstStartService.java
sk.henrichg.phoneprofiles.GUIData.java
sk.henrichg.phoneprofiles.GlobalData.java
sk.henrichg.phoneprofiles.IconWidgetProvider.java
sk.henrichg.phoneprofiles.ImageViewPreferenceAdapter.java
sk.henrichg.phoneprofiles.ImageViewPreferenceDialog.java
sk.henrichg.phoneprofiles.ImageViewPreference.java
sk.henrichg.phoneprofiles.KeyguardService.java
sk.henrichg.phoneprofiles.Keyguard.java
sk.henrichg.phoneprofiles.LocaleChangedReceiver.java
sk.henrichg.phoneprofiles.NumberPickerPreference.java
sk.henrichg.phoneprofiles.OneRowWidgetProvider.java
sk.henrichg.phoneprofiles.PackageReplacedReceiver.java
sk.henrichg.phoneprofiles.PhoneCallBroadcastReceiver.java
sk.henrichg.phoneprofiles.PhoneCallReceiver.java
sk.henrichg.phoneprofiles.PhoneProfilesDashClockExtension.java
sk.henrichg.phoneprofiles.PhoneProfilesHelper.java
sk.henrichg.phoneprofiles.PhoneProfilesPreferencesActivity.java
sk.henrichg.phoneprofiles.PhoneProfilesPreferencesFragment.java
sk.henrichg.phoneprofiles.ProfileDurationAlarmBroadcastReceiver.java
sk.henrichg.phoneprofiles.ProfileListWidgetFactory.java
sk.henrichg.phoneprofiles.ProfileListWidgetProvider.java
sk.henrichg.phoneprofiles.ProfileListWidgetService.java
sk.henrichg.phoneprofiles.ProfilePreferenceAdapter.java
sk.henrichg.phoneprofiles.ProfilePreferenceDialog.java
sk.henrichg.phoneprofiles.ProfilePreference.java
sk.henrichg.phoneprofiles.ProfilePreferencesFragmentActivity.java
sk.henrichg.phoneprofiles.ProfilePreferencesFragment.java
sk.henrichg.phoneprofiles.ProfilePreferencesIndicator.java
sk.henrichg.phoneprofiles.Profile.java
sk.henrichg.phoneprofiles.ReceiversService.java
sk.henrichg.phoneprofiles.RefreshGUIBroadcastReceiver.java
sk.henrichg.phoneprofiles.RemoteExportDataActivity.java
sk.henrichg.phoneprofiles.RemoveBrightnessViewBroadcastReceiver.java
sk.henrichg.phoneprofiles.ScreenOnOffBroadcastReceiver.java
sk.henrichg.phoneprofiles.ShortcutCreatorActivity.java
sk.henrichg.phoneprofiles.ShortcutCreatorListFragment.java
sk.henrichg.phoneprofiles.ShortcutProfileListAdapter.java
sk.henrichg.phoneprofiles.UpgradePPHelperActivity.java
sk.henrichg.phoneprofiles.VolumeDialogPreference.java