Java Code Examples for android.os.SystemProperties

The following code examples are extracted from open source projects. You can click to vote up the examples that are useful to you.

Example 1

From project android-vpn-server, under directory /src/com/android/server/vpn/.

Source file: DaemonProxy.java

  23 
vote

void start() throws IOException {
  String svc=mName;
  Log.i(mTag,"Start VPN daemon: " + svc);
  SystemProperties.set(SVC_START_CMD,svc);
  if (!blockUntil(SVC_STATE_RUNNING,WAITING_TIME)) {
    throw new IOException("cannot start service: " + svc);
  }
 else {
    mControlSocket=createServiceSocket();
  }
}
 

Example 2

From project android_aosp_packages_apps_Settings, under directory /src/com/android/settings/.

Source file: AccessibilitySettings.java

  23 
vote

/** 
 * Displays a message telling the user that they do not have any accessibility related apps installed and that they can get TalkBack (Google's free screen reader) from Market.
 */
private void displayNoAppsAlert(){
  try {
    PackageManager pm=getPackageManager();
    ApplicationInfo info=pm.getApplicationInfo("com.android.vending",0);
  }
 catch (  NameNotFoundException e) {
    return;
  }
  AlertDialog.Builder noAppsAlert=new AlertDialog.Builder(this);
  noAppsAlert.setTitle(R.string.accessibility_service_no_apps_title);
  noAppsAlert.setMessage(R.string.accessibility_service_no_apps_message);
  noAppsAlert.setPositiveButton(android.R.string.ok,new DialogInterface.OnClickListener(){
    public void onClick(    DialogInterface dialog,    int which){
      String screenreaderMarketLink=SystemProperties.get("ro.screenreader.market",DEFAULT_SCREENREADER_MARKET_LINK);
      Uri marketUri=Uri.parse(screenreaderMarketLink);
      Intent marketIntent=new Intent(Intent.ACTION_VIEW,marketUri);
      startActivity(marketIntent);
      finish();
    }
  }
);
  noAppsAlert.setNegativeButton(android.R.string.cancel,new DialogInterface.OnClickListener(){
    public void onClick(    DialogInterface dialog,    int which){
    }
  }
);
  noAppsAlert.show();
}
 

Example 3

From project android_packages_apps_CellBroadcastReceiver, under directory /src/com/android/cellbroadcastreceiver/.

Source file: CellBroadcastConfigService.java

  23 
vote

static boolean isOperatorDefinedEmergencyId(int messageId){
  String emergencyIdRange=SystemProperties.get("ro.cellbroadcast.emergencyids");
  if (TextUtils.isEmpty(emergencyIdRange)) {
    return false;
  }
  try {
    for (    String channelRange : emergencyIdRange.split(",")) {
      int dashIndex=channelRange.indexOf('-');
      if (dashIndex != -1) {
        int startId=Integer.decode(channelRange.substring(0,dashIndex));
        int endId=Integer.decode(channelRange.substring(dashIndex + 1));
        if (messageId >= startId && messageId <= endId) {
          return true;
        }
      }
 else {
        int emergencyMessageId=Integer.decode(channelRange);
        if (emergencyMessageId == messageId) {
          return true;
        }
      }
    }
  }
 catch (  NumberFormatException e) {
    Log.e(TAG,"Number Format Exception parsing emergency channel range",e);
  }
  return false;
}
 

Example 4

From project android_packages_apps_cmparts, under directory /src/com/cyanogenmod/cmparts/activities/.

Source file: ApplicationActivity.java

  23 
vote

@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  mPm=IPackageManager.Stub.asInterface(ServiceManager.getService("package"));
  if (mPm == null) {
    Log.wtf(LOG_TAG,"Unable to get PackageManager!");
  }
  setTitle(R.string.application_settings_title_subhead);
  addPreferencesFromResource(R.xml.application_settings);
  PreferenceScreen prefSet=getPreferenceScreen();
  mInstallLocationPref=(ListPreference)prefSet.findPreference(INSTALL_LOCATION_PREF);
  String installLocation="0";
  try {
    installLocation=String.valueOf(mPm.getInstallLocation());
  }
 catch (  RemoteException e) {
    Log.e(LOG_TAG,"Unable to get default install location!",e);
  }
  mInstallLocationPref.setValue(installLocation);
  mInstallLocationPref.setOnPreferenceChangeListener(this);
  mSwitchStoragePref=(CheckBoxPreference)prefSet.findPreference(SWITCH_STORAGE_PREF);
  mSwitchStoragePref.setChecked((SystemProperties.getInt("persist.sys.vold.switchexternal",0) == 1));
  if (SystemProperties.get("ro.vold.switchablepair","").equals("")) {
    mSwitchStoragePref.setSummaryOff(R.string.pref_storage_switch_unavailable);
    mSwitchStoragePref.setEnabled(false);
  }
  mMoveAllAppsPref=(CheckBoxPreference)prefSet.findPreference(MOVE_ALL_APPS_PREF);
  mMoveAllAppsPref.setChecked(Settings.Secure.getInt(getContentResolver(),Settings.Secure.ALLOW_MOVE_ALL_APPS_EXTERNAL,0) == 1);
  mEnableManagement=(CheckBoxPreference)prefSet.findPreference(ENABLE_PERMISSIONS_MANAGEMENT);
  mEnableManagement.setChecked(Settings.Secure.getInt(getContentResolver(),Settings.Secure.ENABLE_PERMISSIONS_MANAGEMENT,getResources().getBoolean(com.android.internal.R.bool.config_enablePermissionsManagement) ? 1 : 0) == 1);
  mEnableManagement.setOnPreferenceChangeListener(this);
}
 

Example 5

From project android_packages_apps_phone, under directory /src/com/android/phone/.

Source file: CdmaOptions.java

  23 
vote

private boolean deviceSupportsNvAndRuim(){
  String subscriptionsSupported=SystemProperties.get("ril.subscription.types");
  boolean nvSupported=false;
  boolean ruimSupported=false;
  log("deviceSupportsnvAnRum: prop=" + subscriptionsSupported);
  if (!TextUtils.isEmpty(subscriptionsSupported)) {
    for (    String subscriptionType : subscriptionsSupported.split(",")) {
      subscriptionType=subscriptionType.trim();
      if (subscriptionType.equalsIgnoreCase("NV")) {
        nvSupported=true;
      }
      if (subscriptionType.equalsIgnoreCase("RUIM")) {
        ruimSupported=true;
      }
    }
  }
  log("deviceSupportsnvAnRum: nvSupported=" + nvSupported + " ruimSupported="+ ruimSupported);
  return (nvSupported && ruimSupported);
}
 

Example 6

From project android_packages_apps_SalvageParts, under directory /src/com/salvagemod/salvageparts/activities/.

Source file: PerformanceActivity.java

  23 
vote

public boolean onPreferenceChange(Preference preference,Object newValue){
  if (preference == mHeapsizePref) {
    if (newValue != null) {
      SystemProperties.set(HEAPSIZE_PERSIST_PROP,(String)newValue);
      return true;
    }
  }
  String fname="";
  if (newValue != null) {
    if (preference == mGovernorPref) {
      fname=GOVERNOR;
    }
 else     if (preference == mMinFrequencyPref) {
      fname=FREQ_MIN_FILE;
    }
 else     if (preference == mMaxFrequencyPref) {
      fname=FREQ_MAX_FILE;
    }
    if (writeOneLine(fname,(String)newValue)) {
      if (preference == mGovernorPref) {
        mGovernorPref.setSummary(String.format(mGovernorFormat,(String)newValue));
      }
 else       if (preference == mMinFrequencyPref) {
        mMinFrequencyPref.setSummary(String.format(mMinFrequencyFormat,toMHz((String)newValue)));
      }
 else       if (preference == mMaxFrequencyPref) {
        mMaxFrequencyPref.setSummary(String.format(mMaxFrequencyFormat,toMHz((String)newValue)));
      }
      return true;
    }
 else {
      return false;
    }
  }
  return false;
}
 

Example 7

From project android_packages_apps_TouchWiz30Launcher, under directory /src/com/sec/android/app/twlauncher/.

Source file: BootupListener.java

  23 
vote

public void onReceive(Context context,Intent intent){
  Log.v("bootupListener",(new StringBuilder()).append("IMSI ").append(SystemProperties.get("ril.IMSI")).append(" intent ").append(intent.getAction()).toString());
  if (("AMN".equals(salesCode) || "ORA".equals(salesCode) || "FTM".equals(salesCode)|| "XEC".equals(salesCode)) && !SystemProperties.get("ril.IMSI").equals("999999999999999") && "android.intent.action.BOOT_COMPLETED".equals(intent.getAction())) {
    TelephonyManager telephonymanager=(TelephonyManager)context.getSystemService("phone");
    if (telephonymanager.getSimState() != 1) {
      SharedPreferences sharedpreferences=context.getSharedPreferences("pref_first_Time_boot",0);
      android.content.SharedPreferences.Editor editor=sharedpreferences.edit();
      String s=getIccidPreference(sharedpreferences);
      String s1;
      boolean flag;
      if (s == null)       Log.d("bootupListener","========= iccidPref is null =============");
 else       Log.d("bootupListener",(new StringBuilder()).append("========= iccidPref ============= ").append(s).toString());
      s1=getIccid(telephonymanager);
      if (s1 == null)       Log.d("bootupListener","========= iccid is null =============");
 else       Log.d("bootupListener",(new StringBuilder()).append("========= iccid ============= ").append(s1).toString());
      if (s == null || s1 != null && !s.equals(s1)) {
        Log.d("bootupListener","========= New SIM =============");
        flag=true;
      }
 else {
        flag=false;
      }
      if (flag && s1 != null) {
        editor.putString("sim_iccid",s1);
        Log.d("bootupListener","========= New SIM ICCID added to preferences =============");
        editor.commit();
        Intent intent1=new Intent(context,com / sec / android/ app/ twlauncher/ FlatRateAlertActivity);
        intent1.setFlags(0x10000000);
        context.startActivity(intent1);
      }
    }
  }
}
 

Example 8

From project android_packages_apps_VoiceDialer_2, under directory /src/com/android/voicedialer/.

Source file: VoiceDialerActivity.java

  23 
vote

private String getArg(String name){
  if (name == null)   return null;
  String arg=getIntent().getStringExtra(name);
  if (arg != null)   return arg;
  arg=SystemProperties.get("app.voicedialer." + name);
  return arg != null && arg.length() > 0 ? arg : null;
}
 

Example 9

From project cornerstone, under directory /frameworks/base/core/java/android/view/.

Source file: ViewRootImpl.java

  23 
vote

public ViewRootImpl(Context context){
  super();
  if (MEASURE_LATENCY) {
    if (lt == null) {
      lt=new LatencyTimer(100,1000);
    }
  }
  getWindowSession(context.getMainLooper());
  mThread=Thread.currentThread();
  mLocation=new WindowLeaked(null);
  mLocation.fillInStackTrace();
  mWidth=-1;
  mHeight=-1;
  mDirty=new Rect();
  mTempRect=new Rect();
  mVisRect=new Rect();
  mWinFrame=new Rect();
  mWindow=new W(this);
  mTargetSdkVersion=context.getApplicationInfo().targetSdkVersion;
  mInputMethodCallback=new InputMethodCallback(this);
  mViewVisibility=View.GONE;
  mTransparentRegion=new Region();
  mPreviousTransparentRegion=new Region();
  mFirst=true;
  mAdded=false;
  mAccessibilityManager=AccessibilityManager.getInstance(context);
  mAccessibilityInteractionConnectionManager=new AccessibilityInteractionConnectionManager();
  mAccessibilityManager.addAccessibilityStateChangeListener(mAccessibilityInteractionConnectionManager);
  mAttachInfo=new View.AttachInfo(sWindowSession,mWindow,this,this);
  mViewConfiguration=ViewConfiguration.get(context);
  mDensity=context.getResources().getDisplayMetrics().densityDpi;
  mFallbackEventHandler=PolicyManager.makeNewFallbackEventHandler(context);
  mProfileRendering=Boolean.parseBoolean(SystemProperties.get(PROPERTY_PROFILE_RENDERING,"false"));
}
 

Example 10

From project COSsettings, under directory /src/com/cyanogenmod/cmparts/activities/.

Source file: ApplicationActivity.java

  23 
vote

@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  mPm=IPackageManager.Stub.asInterface(ServiceManager.getService("package"));
  if (mPm == null) {
    Log.wtf(LOG_TAG,"Unable to get PackageManager!");
  }
  setTitle(R.string.application_settings_title_subhead);
  addPreferencesFromResource(R.xml.application_settings);
  PreferenceScreen prefSet=getPreferenceScreen();
  mInstallLocationPref=(ListPreference)prefSet.findPreference(INSTALL_LOCATION_PREF);
  String installLocation="0";
  try {
    installLocation=String.valueOf(mPm.getInstallLocation());
  }
 catch (  RemoteException e) {
    Log.e(LOG_TAG,"Unable to get default install location!",e);
  }
  mInstallLocationPref.setValue(installLocation);
  mInstallLocationPref.setOnPreferenceChangeListener(this);
  mSwitchStoragePref=(CheckBoxPreference)prefSet.findPreference(SWITCH_STORAGE_PREF);
  mSwitchStoragePref.setChecked((SystemProperties.getInt("persist.sys.vold.switchexternal",0) == 1));
  if (SystemProperties.get("ro.vold.switchablepair","").equals("")) {
    mSwitchStoragePref.setSummaryOff(R.string.pref_storage_switch_unavailable);
    mSwitchStoragePref.setEnabled(false);
  }
  mMoveAllAppsPref=(CheckBoxPreference)prefSet.findPreference(MOVE_ALL_APPS_PREF);
  mMoveAllAppsPref.setChecked(Settings.Secure.getInt(getContentResolver(),Settings.Secure.ALLOW_MOVE_ALL_APPS_EXTERNAL,0) == 1);
  mEnableManagement=(CheckBoxPreference)prefSet.findPreference(ENABLE_PERMISSIONS_MANAGEMENT);
  mEnableManagement.setChecked(Settings.Secure.getInt(getContentResolver(),Settings.Secure.ENABLE_PERMISSIONS_MANAGEMENT,getResources().getBoolean(com.android.internal.R.bool.config_enablePermissionsManagement) ? 1 : 0) == 1);
  mEnableManagement.setOnPreferenceChangeListener(this);
}
 

Example 11

From project creamed_glacier_app_settings, under directory /src/com/android/settings/.

Source file: AccessibilitySettings.java

  23 
vote

@Override public Dialog onCreateDialog(int dialogId){
switch (dialogId) {
case DIALOG_ID_NO_ACCESSIBILITY_SERVICES:
    return new AlertDialog.Builder(getActivity()).setTitle(R.string.accessibility_service_no_apps_title).setMessage(R.string.accessibility_service_no_apps_message).setPositiveButton(android.R.string.ok,new DialogInterface.OnClickListener(){
      public void onClick(      DialogInterface dialog,      int which){
        removeDialog(DIALOG_ID_NO_ACCESSIBILITY_SERVICES);
        String screenreaderMarketLink=SystemProperties.get(SYSTEM_PROPERTY_MARKET_URL,DEFAULT_SCREENREADER_MARKET_LINK);
        Uri marketUri=Uri.parse(screenreaderMarketLink);
        Intent marketIntent=new Intent(Intent.ACTION_VIEW,marketUri);
        startActivity(marketIntent);
      }
    }
).setNegativeButton(android.R.string.cancel,null).create();
default :
  return null;
}
}
 

Example 12

From project DeskSMS, under directory /DeskSMS/src/com/koushikdutta/desktopsms/.

Source file: Helper.java

  23 
vote

@SuppressLint("NewApi") static public String getSafeDeviceId(Context context){
  TelephonyManager tm=(TelephonyManager)context.getSystemService(Context.TELEPHONY_SERVICE);
  String deviceId=tm.getDeviceId();
  if (deviceId == null) {
    String wifiInterface=SystemProperties.get("wifi.interface");
    try {
      if (Build.VERSION.SDK_INT < 9)       throw new Exception();
      String wifiMac=new String(NetworkInterface.getByName(wifiInterface).getHardwareAddress());
      deviceId=wifiMac;
    }
 catch (    Exception e) {
      deviceId="000000000000";
    }
  }
  deviceId+=context.getPackageName();
  String ret=digest(deviceId);
  return ret;
}
 

Example 13

From project framework_base_policy, under directory /src/com/android/internal/policy/impl/.

Source file: KeyguardViewMediator.java

  23 
vote

/** 
 * Enable the keyguard if the settings are appropriate.  Return true if all work that will happen is done; returns false if the caller can wait for the keyguard to be shown.
 */
private void doKeyguardLocked(){
  if (!mExternallyEnabled) {
    if (DEBUG)     Log.d(TAG,"doKeyguard: not showing because externally disabled");
    return;
  }
  if (mKeyguardViewManager.isShowing()) {
    if (DEBUG)     Log.d(TAG,"doKeyguard: not showing because it is already showing");
    return;
  }
  final boolean requireSim=!SystemProperties.getBoolean("keyguard.no_require_sim",false);
  final boolean provisioned=mUpdateMonitor.isDeviceProvisioned();
  final IccCard.State state=mUpdateMonitor.getSimState();
  final boolean lockedOrMissing=state.isPinLocked() || ((state == IccCard.State.ABSENT || state == IccCard.State.PERM_DISABLED) && requireSim);
  if (!lockedOrMissing && !provisioned) {
    if (DEBUG)     Log.d(TAG,"doKeyguard: not showing because device isn't provisioned" + " and the sim is not locked or missing");
    return;
  }
  if (mLockPatternUtils.isLockScreenDisabled() && !lockedOrMissing) {
    if (DEBUG)     Log.d(TAG,"doKeyguard: not showing because lockscreen is off");
    return;
  }
  if (DEBUG)   Log.d(TAG,"doKeyguard: showing the lock screen");
  showLocked();
}
 

Example 14

From project packages_apps_BlackICEControl, under directory /src/com/blackice/control/fragments/.

Source file: DensityChanger.java

  23 
vote

@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  addPreferencesFromResource(R.xml.lcd_density_setup);
  String currentDensity=SystemProperties.get("ro.sf.lcd_density");
  PreferenceScreen prefs=getPreferenceScreen();
  mStockDensity=(ListPreference)findPreference("stock_density");
  mStockDensity.setOnPreferenceChangeListener(this);
  mReboot=findPreference("reboot");
  mClearMarketData=findPreference("clear_market_data");
  mOpenMarket=findPreference("open_market");
  mCustomDensity=(ListPreference)findPreference("lcd_density");
  mCustomDensity.setOnPreferenceChangeListener(this);
}
 

Example 15

From project packages_apps_Phone_1, under directory /src/com/android/phone/.

Source file: CdmaOptions.java

  23 
vote

private boolean deviceSupportsNvAndRuim(){
  String subscriptionsSupported=SystemProperties.get("ril.subscription.types");
  boolean nvSupported=false;
  boolean ruimSupported=false;
  log("deviceSupportsnvAnRum: prop=" + subscriptionsSupported);
  if (!TextUtils.isEmpty(subscriptionsSupported)) {
    for (    String subscriptionType : subscriptionsSupported.split(",")) {
      subscriptionType=subscriptionType.trim();
      if (subscriptionType.equalsIgnoreCase("NV")) {
        nvSupported=true;
      }
      if (subscriptionType.equalsIgnoreCase("RUIM")) {
        ruimSupported=true;
      }
    }
  }
  log("deviceSupportsnvAnRum: nvSupported=" + nvSupported + " ruimSupported="+ ruimSupported);
  return (nvSupported && ruimSupported);
}
 

Example 16

From project packages_apps_ROMControl, under directory /src/com/aokp/romcontrol/fragments/.

Source file: DensityChanger.java

  23 
vote

@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  addPreferencesFromResource(R.xml.lcd_density_setup);
  String currentDensity=SystemProperties.get("ro.sf.lcd_density");
  PreferenceScreen prefs=getPreferenceScreen();
  mStockDensity=(ListPreference)findPreference("stock_density");
  mStockDensity.setOnPreferenceChangeListener(this);
  mReboot=findPreference("reboot");
  mClearMarketData=findPreference("clear_market_data");
  mOpenMarket=findPreference("open_market");
  mCustomDensity=(ListPreference)findPreference("lcd_density");
  mCustomDensity.setOnPreferenceChangeListener(this);
}
 

Example 17

From project PinyinIME, under directory /src/com/android/inputmethod/pinyin/.

Source file: SkbContainer.java

  23 
vote

public SkbContainer(Context context,AttributeSet attrs){
  super(context,attrs);
  mEnvironment=Environment.getInstance();
  mLongPressTimer=new LongPressTimer(this);
  if ("1".equals(SystemProperties.get("ro.kernel.qemu"))) {
    mYBiasCorrection=0;
  }
 else {
    mYBiasCorrection=Y_BIAS_CORRECTION;
  }
  mBalloonPopup=new BalloonHint(context,this,MeasureSpec.AT_MOST);
  if (POPUPWINDOW_FOR_PRESSED_UI) {
    mBalloonOnKey=new BalloonHint(context,this,MeasureSpec.AT_MOST);
  }
  mPopupSkb=new PopupWindow(mContext);
  mPopupSkb.setBackgroundDrawable(null);
  mPopupSkb.setClippingEnabled(false);
}
 

Example 18

From project platform_frameworks_policies_base, under directory /phone/com/android/internal/policy/impl/.

Source file: KeyguardViewMediator.java

  23 
vote

/** 
 * Enable the keyguard if the settings are appropriate.
 */
private void doKeyguard(){
synchronized (this) {
    if (!mExternallyEnabled) {
      if (DEBUG)       Log.d(TAG,"doKeyguard: not showing because externally disabled");
      return;
    }
    if (mKeyguardViewManager.isShowing()) {
      if (DEBUG)       Log.d(TAG,"doKeyguard: not showing because it is already showing");
      return;
    }
    final boolean requireSim=!SystemProperties.getBoolean("keyguard.no_require_sim",false);
    final boolean provisioned=mUpdateMonitor.isDeviceProvisioned();
    final IccCard.State state=mUpdateMonitor.getSimState();
    final boolean lockedOrMissing=state.isPinLocked() || ((state == IccCard.State.ABSENT) && requireSim);
    if (!lockedOrMissing && !provisioned) {
      if (DEBUG)       Log.d(TAG,"doKeyguard: not showing because device isn't provisioned" + " and the sim is not locked or missing");
      return;
    }
    if (DEBUG)     Log.d(TAG,"doKeyguard: showing the lock screen");
    showLocked();
  }
}
 

Example 19

From project platform_packages_apps_contacts, under directory /src/com/android/contacts/dialpad/.

Source file: DialpadFragment.java

  23 
vote

/** 
 * In most cases, when the dial button is pressed, there is a number in digits area. Pack it in the intent, start the outgoing call broadcast as a separate task and finish this activity. When there is no digit and the phone is CDMA and off hook, we're sending a blank flash for CDMA. CDMA networks use Flash messages when special processing needs to be done, mainly for 3-way or call waiting scenarios. Presumably, here we're in a special 3-way scenario where the network needs a blank flash before being able to add the new participant.  (This is not the case with all 3-way calls, just certain CDMA infrastructures.) Otherwise, there is no digit, display the last dialed number. Don't finish since the user may want to edit it. The user needs to press the dial button again, to dial it (general case described above).
 */
public void dialButtonPressed(){
  if (isDigitsEmpty()) {
    handleDialButtonClickWithEmptyDigits();
  }
 else {
    final String number=mDigits.getText().toString();
    if (number != null && !TextUtils.isEmpty(mProhibitedPhoneNumberRegexp) && number.matches(mProhibitedPhoneNumberRegexp) && (SystemProperties.getInt("persist.radio.otaspdial",0) != 1)) {
      Log.i(TAG,"The phone number is prohibited explicitly by a rule.");
      if (getActivity() != null) {
        DialogFragment dialogFragment=ErrorDialogFragment.newInstance(R.string.dialog_phone_call_prohibited_message);
        dialogFragment.show(getFragmentManager(),"phone_prohibited_dialog");
      }
      mDigits.getText().clear();
    }
 else {
      final Intent intent=ContactsUtils.getCallIntent(number,(getActivity() instanceof DialtactsActivity ? ((DialtactsActivity)getActivity()).getCallOrigin() : null));
      startActivity(intent);
      mClearDigitsOnStop=true;
      getActivity().finish();
    }
  }
}
 

Example 20

From project platform_packages_apps_CytownPhone, under directory /src/com/android/phone/.

Source file: CdmaOptions.java

  23 
vote

private boolean deviceSupportsNvAndRuim(){
  String subscriptionsSupported=SystemProperties.get("ril.subscription.types");
  boolean nvSupported=false;
  boolean ruimSupported=false;
  log("deviceSupportsnvAnRum: prop=" + subscriptionsSupported);
  if (!TextUtils.isEmpty(subscriptionsSupported)) {
    for (    String subscriptionType : subscriptionsSupported.split(",")) {
      subscriptionType=subscriptionType.trim();
      if (subscriptionType.equalsIgnoreCase("NV")) {
        nvSupported=true;
      }
      if (subscriptionType.equalsIgnoreCase("RUIM")) {
        ruimSupported=true;
      }
    }
  }
  log("deviceSupportsnvAnRum: nvSupported=" + nvSupported + " ruimSupported="+ ruimSupported);
  return (nvSupported && ruimSupported);
}
 

Example 21

From project platform_packages_apps_im, under directory /src/com/android/im/service/.

Source file: RemoteImService.java

  23 
vote

private Map<String,String> loadProviderSettings(long providerId){
  ContentResolver cr=getContentResolver();
  Map<String,String> settings=Imps.ProviderSettings.queryProviderSettings(cr,providerId);
  NetworkInfo networkInfo=mNetworkConnectivityListener.getNetworkInfo();
  if ("1".equals(SystemProperties.get("ro.kernel.qemu"))) {
    settings.put(ImpsConfigNames.MSISDN,"15555218135");
  }
 else   if (networkInfo != null && networkInfo.getType() == ConnectivityManager.TYPE_WIFI) {
    if (!TextUtils.isEmpty(settings.get(ImpsConfigNames.SMS_ADDR))) {
      settings.put(ImpsConfigNames.SMS_AUTH,"true");
      settings.put(ImpsConfigNames.SECURE_LOGIN,"false");
    }
 else {
      String msisdn=TelephonyManager.getDefault().getLine1Number();
      if (TextUtils.isEmpty(msisdn)) {
        Log.w(TAG,"Can not read MSISDN from SIM, use a fake one." + " SMS related feature won't work.");
        msisdn="15555218135";
      }
      settings.put(ImpsConfigNames.MSISDN,msisdn);
    }
  }
  return settings;
}
 

Example 22

From project platform_packages_apps_mms, under directory /src/com/android/mms/ui/.

Source file: ComposeMessageActivity.java

  23 
vote

private void sendMessage(boolean bCheckEcmMode){
  if (bCheckEcmMode) {
    String inEcm=SystemProperties.get(TelephonyProperties.PROPERTY_INECM_MODE);
    if (Boolean.parseBoolean(inEcm)) {
      try {
        startActivityForResult(new Intent(TelephonyIntents.ACTION_SHOW_NOTICE_ECM_BLOCK_OTHERS,null),REQUEST_CODE_ECM_EXIT_DIALOG);
        return;
      }
 catch (      ActivityNotFoundException e) {
        Log.e(TAG,"Cannot find EmergencyCallbackModeExitDialog",e);
      }
    }
  }
  if (!mSendingMessage) {
    if (LogTag.SEVERE_WARNING) {
      String sendingRecipients=mConversation.getRecipients().serialize();
      if (!sendingRecipients.equals(mDebugRecipients)) {
        String workingRecipients=mWorkingMessage.getWorkingRecipients();
        if (!mDebugRecipients.equals(workingRecipients)) {
          LogTag.warnPossibleRecipientMismatch("ComposeMessageActivity.sendMessage" + " recipients in window: \"" + mDebugRecipients + "\" differ from recipients from conv: \""+ sendingRecipients+ "\" and working recipients: "+ workingRecipients,this);
        }
      }
      sanityCheckConversation();
    }
    removeRecipientsListeners();
    mWorkingMessage.send(mDebugRecipients);
    mSentMessage=true;
    mSendingMessage=true;
    addRecipientsListeners();
    mScrollOnSend=true;
  }
  if (mExitOnSent) {
    finish();
  }
}
 

Example 23

From project platform_packages_apps_phone, under directory /src/com/android/phone/.

Source file: CdmaOptions.java

  23 
vote

private boolean deviceSupportsNvAndRuim(){
  String subscriptionsSupported=SystemProperties.get("ril.subscription.types");
  boolean nvSupported=false;
  boolean ruimSupported=false;
  log("deviceSupportsnvAnRum: prop=" + subscriptionsSupported);
  if (!TextUtils.isEmpty(subscriptionsSupported)) {
    for (    String subscriptionType : subscriptionsSupported.split(",")) {
      subscriptionType=subscriptionType.trim();
      if (subscriptionType.equalsIgnoreCase("NV")) {
        nvSupported=true;
      }
      if (subscriptionType.equalsIgnoreCase("RUIM")) {
        ruimSupported=true;
      }
    }
  }
  log("deviceSupportsnvAnRum: nvSupported=" + nvSupported + " ruimSupported="+ ruimSupported);
  return (nvSupported && ruimSupported);
}
 

Example 24

From project platform_packages_apps_settings, under directory /src/com/android/settings/.

Source file: AccessibilitySettings.java

  23 
vote

private void offerInstallAccessibilitySerivceOnce(){
  if (mServicesCategory.getPreference(0) != mNoServicesMessagePreference) {
    return;
  }
  SharedPreferences preferences=getActivity().getPreferences(Context.MODE_PRIVATE);
  final boolean offerInstallService=!preferences.getBoolean(KEY_INSTALL_ACCESSIBILITY_SERVICE_OFFERED_ONCE,false);
  if (offerInstallService) {
    String screenreaderMarketLink=SystemProperties.get(SYSTEM_PROPERTY_MARKET_URL,DEFAULT_SCREENREADER_MARKET_LINK);
    Uri marketUri=Uri.parse(screenreaderMarketLink);
    Intent marketIntent=new Intent(Intent.ACTION_VIEW,marketUri);
    if (getPackageManager().resolveActivity(marketIntent,0) == null) {
      return;
    }
    preferences.edit().putBoolean(KEY_INSTALL_ACCESSIBILITY_SERVICE_OFFERED_ONCE,true).commit();
    showDialog(DIALOG_ID_NO_ACCESSIBILITY_SERVICES);
  }
}
 

Example 25

From project platform_packages_apps_voicedialer, under directory /src/com/android/voicedialer/.

Source file: VoiceDialerActivity.java

  23 
vote

private String getArg(String name){
  if (name == null)   return null;
  String arg=getIntent().getStringExtra(name);
  if (arg != null)   return arg;
  arg=SystemProperties.get("app.voicedialer." + name);
  return arg != null && arg.length() > 0 ? arg : null;
}
 

Example 26

From project platform_packages_providers_contactsprovider, under directory /src/com/android/providers/contacts/.

Source file: ContactsProvider2.java

  23 
vote

/** 
 * (Re)allocates all locale-sensitive structures.
 */
private void initForDefaultLocale(){
  Context context=getContext();
  mLegacyApiSupport=new LegacyApiSupport(context,mContactsHelper,this,mGlobalSearchSupport);
  mCurrentLocale=getLocale();
  mNameSplitter=mContactsHelper.createNameSplitter();
  mNameLookupBuilder=new StructuredNameLookupBuilder(mNameSplitter);
  mPostalSplitter=new PostalSplitter(mCurrentLocale);
  mCommonNicknameCache=new CommonNicknameCache(mContactsHelper.getReadableDatabase());
  ContactLocaleUtils.getIntance().setLocale(mCurrentLocale);
  mContactAggregator=new ContactAggregator(this,mContactsHelper,createPhotoPriorityResolver(context),mNameSplitter,mCommonNicknameCache);
  mContactAggregator.setEnabled(SystemProperties.getBoolean(AGGREGATE_CONTACTS,true));
  mProfileAggregator=new ProfileAggregator(this,mProfileHelper,createPhotoPriorityResolver(context),mNameSplitter,mCommonNicknameCache);
  mProfileAggregator.setEnabled(SystemProperties.getBoolean(AGGREGATE_CONTACTS,true));
  mSearchIndexManager=new SearchIndexManager(this);
  mContactsPhotoStore=new PhotoStore(getContext().getFilesDir(),mContactsHelper);
  mProfilePhotoStore=new PhotoStore(new File(getContext().getFilesDir(),"profile"),mProfileHelper);
  mDataRowHandlers=new HashMap<String,DataRowHandler>();
  initDataRowHandlers(mDataRowHandlers,mContactsHelper,mContactAggregator,mContactsPhotoStore);
  mProfileDataRowHandlers=new HashMap<String,DataRowHandler>();
  initDataRowHandlers(mProfileDataRowHandlers,mProfileHelper,mProfileAggregator,mProfilePhotoStore);
  switchToContactMode();
}