// When a WebView is paused, we also want to pause the video in it. public static void pauseAndDispatch() { Xlog.d(XLOGTAG, "HTML5VideoViewProxy.pauseAndDispatch()"); Xlog.d(XLOGTAG, "stack:" + Thread.currentThread().getStackTrace()); if (mHTML5VideoView != null) { mHTML5VideoView.pauseAndDispatch(mCurrentProxy); } }
void updateSignalStrength() { // TODO PhoneStateIntentReceiver is deprecated and PhoneStateListener // should probably used instead. // not loaded in some versions of the code (e.g., zaku) if (mSignalStrength != null) { int state = mPhoneStateReceiver.getServiceState().getState(); Resources r = getResources(); if ((ServiceState.STATE_OUT_OF_SERVICE == state) || (ServiceState.STATE_POWER_OFF == state)) { mSignalStrength.setSummary("0"); } int signalDbm = mPhoneStateReceiver.getSignalStrengthDbm(); Xlog.d(TAG, "updateSignalStrength() signalDbm : " + signalDbm); if (-1 == signalDbm) signalDbm = 0; int signalAsu = mPhoneStateReceiver.getSignalStrengthLevelAsu(); Xlog.d(TAG, "updateSignalStrength() signalAsu : " + signalAsu); if (-1 == signalAsu) signalAsu = 0; mSignalStrength.setSummary( String.valueOf(signalDbm) + " " + r.getString(R.string.radioInfo_display_dbm) + " " + String.valueOf(signalAsu) + " " + r.getString(R.string.radioInfo_display_asu)); } }
@Override public void handleMessage(Message msg) { if (!EMWifi.sIsInitialed) { showDialog(DIALOG_WIFI_ERROR); return; } if (HANDLER_EVENT_RX == msg.what) { long[] i4Rx = new long[2]; long i4RxCntOk = -1; long i4RxCntFcsErr = -1; long i4RxPer = -1; Xlog.i(TAG, "The Handle event is : HANDLER_EVENT_RX"); try { i4RxPer = Long.parseLong(mTvPer.getText().toString()); } catch (NumberFormatException e) { Xlog.d(TAG, "Long.parseLong NumberFormatException: " + e.getMessage()); } EMWifi.getPacketRxStatus(i4Rx, 2); Xlog.d(TAG, "after rx test: rx ok = " + String.valueOf(i4Rx[0])); Xlog.d(TAG, "after rx test: fcs error = " + String.valueOf(i4Rx[1])); i4RxCntOk = i4Rx[0] /* - i4Init[0] */; i4RxCntFcsErr = i4Rx[1] /* - i4Init[1] */; if (i4RxCntFcsErr + i4RxCntOk != 0) { i4RxPer = i4RxCntFcsErr * PERCENT / (i4RxCntFcsErr + i4RxCntOk); } mTvFcs.setText(String.valueOf(i4RxCntFcsErr)); mTvRx.setText(String.valueOf(i4RxCntOk)); mTvPer.setText(String.valueOf(i4RxPer)); } mHandler.sendEmptyMessageDelayed(HANDLER_EVENT_RX, HANDLER_RX_DELAY_TIME); }
@Override public void onSwitchChanged(Switch switchView, boolean desiredState) { Xlog.d( TAG, "onCheckedChanged, desiredState " + desiredState + " mUpdateStatusOnly " + mUpdateStatusOnly); // turn off card emulation, set the active mode off and clear the screen if (mUpdateStatusOnly) { return; } if (!desiredState) { Settings.Global.putString( getContentResolver(), Settings.Global.NFC_MULTISE_ACTIVE, EMULATION_OFF); Xlog.d( TAG, "onCheckedChanged, set Settings.Global.NFC_MULTISE_ACTIVE EMULATION_OFF" + EMULATION_OFF); } else { // set the active mode is the list first elment and add preference String previousMode = Settings.Global.getString(getContentResolver(), Settings.Global.NFC_MULTISE_PREVIOUS); Settings.Global.putString( getContentResolver(), Settings.Global.NFC_MULTISE_ACTIVE, previousMode); Xlog.d(TAG, "onCheckedChanged, set active mode to " + previousMode); } mSwitchBar.setEnabled(false); }
/** * Class constructor. * * @param audioSource the recording source. See {@link MediaRecorder.AudioSource} for recording * source definitions. * @param sampleRateInHz the sample rate expressed in Hertz. 44100Hz is currently the only rate * that is guaranteed to work on all devices, but other rates such as 22050, 16000, and 11025 * may work on some devices. * @param channelConfig describes the configuration of the audio channels. See {@link * AudioFormat#CHANNEL_IN_MONO} and {@link AudioFormat#CHANNEL_IN_STEREO}. {@link * AudioFormat#CHANNEL_IN_MONO} is guaranteed to work on all devices. * @param audioFormat the format in which the audio data is represented. See {@link * AudioFormat#ENCODING_PCM_16BIT} and {@link AudioFormat#ENCODING_PCM_8BIT} * @param bufferSizeInBytes the total size (in bytes) of the buffer where audio data is written to * during the recording. New audio data can be read from this buffer in smaller chunks than * this size. See {@link #getMinBufferSize(int, int, int)} to determine the minimum required * buffer size for the successful creation of an AudioRecord instance. Using values smaller * than getMinBufferSize() will result in an initialization failure. * @throws java.lang.IllegalArgumentException */ public AudioRecord( int audioSource, int sampleRateInHz, int channelConfig, int audioFormat, int bufferSizeInBytes) throws IllegalArgumentException { /// M: Check record permission to user for CTA. {@ if (FeatureOption.MTK_MOBILE_MANAGEMENT) { Xlog.d(TAG, "AudioRecord>>>"); IBinder binder = ServiceManager.getService(Context.MOBILE_SERVICE); IMobileManagerService moms = IMobileManagerService.Stub.asInterface(binder); int uid = Binder.getCallingUid(); String permission = SubPermissions.RECORD_MIC; try { if (moms != null && (moms.checkPermission(permission, uid) != PackageManager.PERMISSION_GRANTED)) { Xlog.d(TAG, "AudioRecord<<<: user denied permission " + permission + " for uid " + uid); throw new IllegalArgumentException(); } } catch (RemoteException e) { Xlog.e(TAG, "CheckPermission failed in prepare with RemoteException, continues record.", e); } } /// @} mRecordingState = RECORDSTATE_STOPPED; // remember which looper is associated with the AudioRecord instanciation if ((mInitializationLooper = Looper.myLooper()) == null) { mInitializationLooper = Looper.getMainLooper(); } audioParamCheck(audioSource, sampleRateInHz, channelConfig, audioFormat); audioBuffSizeCheck(bufferSizeInBytes); // native initialization int[] session = new int[1]; session[0] = 0; // TODO: update native initialization when information about hardware init failure // due to capture device already open is available. int initResult = native_setup( new WeakReference<AudioRecord>(this), mRecordSource, mSampleRate, mChannelMask, mAudioFormat, mNativeBufferSizeInBytes, session); if (initResult != SUCCESS) { loge("Error code " + initResult + " when initializing native AudioRecord object."); return; // with mState == STATE_UNINITIALIZED } mSessionId = session[0]; mState = STATE_INITIALIZED; }
private void updateState(String[] available, String[] tethered, String[] errored) { /// M: @{ if (mUsbInternetSharing) { /// M: add for not update BT tether state updateBluetoothState(available, tethered, errored); mUsbTether.setEnabled(false); mBluetoothTether.setEnabled(false); Xlog.d(TAG, "usb internet is connected, return"); return; } /// @} Xlog.d( TAG, "=======> updateState - mUsbConnected: " + mUsbConnected + ", mUsbConfigured: " + mUsbConfigured + ", mUsbHwDisconnected: " + mUsbHwDisconnected + ", checked: " + mUsbTether.isChecked() + ", mUsbUnTetherDone: " + mUsbUnTetherDone + ", mUsbTetherDone: " + mUsbTetherDone + ", tetherfail: " + mUsbTetherFail + ", mIsPcKnowMe: " + mIsPcKnowMe); /** M: for bug solving, ALPS00331223 */ // turn on tethering case if (mUsbTether.isChecked()) { if (mUsbConnected && mUsbConfigured && !mUsbHwDisconnected) { if (mUsbTetherFail || mUsbTetherDone || !mIsPcKnowMe) { mUsbTetherCheckEnable = true; } } else { mUsbTetherCheckEnable = false; } } else { // turn off tethering case or first launch case if (mUsbConnected && !mUsbHwDisconnected) { if (mUsbUnTetherDone || mUsbTetherFail) { mUsbTetherCheckEnable = true; } } else { mUsbTetherCheckEnable = false; } } updateUsbState(available, tethered, errored); updateBluetoothState(available, tethered, errored); /// M: @{ if (FeatureOption.MTK_TETHERINGIPV6_SUPPORT) { updateIpv6Preference(); } /// @} }
public WapPushFwkExt(Context context, int phoneId) { if (context == null) { Xlog.d(TAG, "FAIL! context is null"); return; } mContext = context; mPhoneId = phoneId; Xlog.d(TAG, "call WapPushFwkExt constructor"); }
@Override public boolean checkPermission() { if (is4GDataOnly()) { startService(); Xlog.d(TAG, "checkPermission result : false"); return false; } Xlog.d(TAG, "checkPermission result : true"); return true; }
/** for inheritence. */ protected String getFillListQuery() { boolean isMVNO = false; try { ITelephony telephony = ITelephony.Stub.asInterface(ServiceManager.getService(Context.TELEPHONY_SERVICE)); if (FeatureOption.MTK_MVNO_SUPPORT) { if (FeatureOption.MTK_GEMINI_SUPPORT) { isMVNO = telephony.isIccCardProviderAsMvnoGemini(mSimId); } else { isMVNO = telephony.isIccCardProviderAsMvno(); } } } catch (android.os.RemoteException e) { Xlog.d(TAG, "RemoteException"); } boolean flagImsi = false; boolean flagSpn = false; boolean flagPnn = false; String sqlStr = ""; Xlog.d(TAG, "[isMVNO =" + isMVNO + "]"); if (FeatureOption.MTK_MVNO_SUPPORT) { if (isMVNO) { if (mIMSI != null && !mIMSI.isEmpty()) { flagImsi = true; sqlStr += " imsi=\"" + mIMSI + "\""; } if (mSpn != null && !mSpn.isEmpty()) { flagSpn = true; if (flagImsi) { sqlStr += " or spn=\"" + mSpn + "\""; } else { sqlStr += " spn=\"" + mSpn + "\""; } } if (mPnn != null && !mPnn.isEmpty()) { flagPnn = true; if (flagImsi || flagSpn) { sqlStr += " or pnn=\"" + mPnn + "\""; } else { sqlStr += " pnn=\"" + mPnn + "\""; } } } else { sqlStr = "(spn is NULL or spn=\"\") and (imsi is NULL or imsi=\"\") and (pnn is NULL or pnn=\"\") "; } } String result = "numeric=\"" + mNumeric + "\" and ( " + sqlStr + ")"; Xlog.e(TAG, "getFillListQuery result: " + result); return result; }
@Override public void onCreate(Bundle icicle) { super.onCreate(icicle); mConnectivityManager = (ConnectivityManager) getActivity().getSystemService(Context.CONNECTIVITY_SERVICE); Bundle bundle = this.getArguments(); Xlog.d(TAG, "onCreate activity,bundle = " + bundle + ",this = " + this); if (bundle != null) { mSelectedSystemIndex = bundle.getInt(UsbSharingChoose.SYSTEM_TYPE); } Xlog.d(TAG, "index is " + mSelectedSystemIndex); }
public static void setPendingMmsFailed(final Context context) { Xlog.d(MmsApp.TXN_TAG, "setPendingMmsFailed"); Cursor cursor = PduPersister.getPduPersister(context) .getPendingMessages(Long.MAX_VALUE /*System.currentTimeMillis()*/); if (cursor != null) { try { int count = cursor.getCount(); Xlog.d(MmsApp.TXN_TAG, "setPendingMmsFailed: Pending Message Size=" + count); if (count == 0) { return; } DefaultRetryScheme scheme = new DefaultRetryScheme(context, 100); ContentValues values = null; int columnIndex = 0; int columnType = 0; int id = 0; int type = 0; while (cursor.moveToNext()) { columnIndex = cursor.getColumnIndexOrThrow(PendingMessages._ID); id = cursor.getInt(columnIndex); columnType = cursor.getColumnIndexOrThrow(PendingMessages.MSG_TYPE); type = cursor.getInt(columnType); Xlog.d(MmsApp.TXN_TAG, "setPendingMmsFailed: type=" + type + "; MsgId=" + id); if (type == PduHeaders.MESSAGE_TYPE_SEND_REQ) { values = new ContentValues(2); values.put(PendingMessages.ERROR_TYPE, MmsSms.ERR_TYPE_GENERIC_PERMANENT); values.put(PendingMessages.RETRY_INDEX, scheme.getRetryLimit()); SqliteWrapper.update( context, context.getContentResolver(), PendingMessages.CONTENT_URI, values, PendingMessages._ID + "=" + id, null); } } } catch (SQLiteDiskIOException e) { // Ignore Xlog.e(MmsApp.TXN_TAG, "SQLiteDiskIOException caught while set pending message failed", e); } finally { cursor.close(); } } else { Xlog.d(MmsApp.TXN_TAG, "setPendingMmsFailed: no pending MMS."); } }
public static void setNotificationIndUnstarted(final Context context) { Xlog.d(MmsApp.TXN_TAG, "setNotificationIndUnstarted"); Cursor cursor = SqliteWrapper.query( context, context.getContentResolver(), Mms.CONTENT_URI, new String[] {Mms._ID, Mms.STATUS}, Mms.MESSAGE_TYPE + "=" + PduHeaders.MESSAGE_TYPE_NOTIFICATION_IND, null, null); if (cursor != null) { try { int count = cursor.getCount(); Xlog.d(MmsApp.TXN_TAG, "setNotificationIndUnstarted: Message Size=" + count); if (count == 0) { return; } ContentValues values = null; int id = 0; int status = 0; while (cursor.moveToNext()) { id = cursor.getInt(0); status = cursor.getInt(1); Xlog.d(MmsApp.TXN_TAG, "setNotificationIndUnstarted: MsgId=" + id + "; status=" + status); if (DownloadManager.STATE_DOWNLOADING == (status & ~DownloadManager.DEFERRED_MASK)) { values = new ContentValues(1); values.put(Mms.STATUS, PduHeaders.STATUS_UNRECOGNIZED); SqliteWrapper.update( context, context.getContentResolver(), Mms.CONTENT_URI, values, Mms._ID + "=" + id, null); } } } catch (SQLiteDiskIOException e) { // Ignore Xlog.e( MmsApp.TXN_TAG, "SQLiteDiskIOException caught while set notification ind unstart", e); } finally { cursor.close(); } } else { Xlog.d(MmsApp.TXN_TAG, "setNotificationIndUnstarted: no pending messages."); } }
private void initSimState() { if (FeatureOption.MTK_GEMINI_SUPPORT) { Intent it = getIntent(); mSimId = it.getIntExtra("simId", SIM_CARD_UNDEFINED); if (SIMInfo.getInsertedSIMCount(this) > 1) { SIMInfo siminfo = SIMInfo.getSIMInfoBySlot(this, mSimId); if (siminfo != null) { setTitle(siminfo.mDisplayName); } } Xlog.d(TAG, "GEMINI_SIM_ID_KEY = " + mSimId); } else { Xlog.w(TAG, "Not support GEMINI"); mSimId = SIM_CARD_SINGLE; } switch (mSimId) { case SIM_CARD_SINGLE: mUri = Telephony.Carriers.CONTENT_URI; mNumeric = SystemProperties.get(TelephonyProperties.PROPERTY_ICC_OPERATOR_NUMERIC, "-1"); mDefaultApnUri = DEFAULTAPN_URI; mRestoreCarrierUri = PREFERAPN_URI; break; case SIM_CARD_1: mUri = Telephony.Carriers.SIM1Carriers.CONTENT_URI; mNumeric = SystemProperties.get(TelephonyProperties.PROPERTY_ICC_OPERATOR_NUMERIC, "-1"); mDefaultApnUri = DEFAULTAPN_URI_GEMINI_SIM1; mRestoreCarrierUri = PREFERAPN_URI_GEMINI_SIM1; break; case SIM_CARD_2: mUri = Telephony.Carriers.SIM2Carriers.CONTENT_URI; mNumeric = SystemProperties.get(TelephonyProperties.PROPERTY_ICC_OPERATOR_NUMERIC_2, "-1"); mDefaultApnUri = DEFAULTAPN_URI_GEMINI_SIM2; mRestoreCarrierUri = PREFERAPN_URI_GEMINI_SIM2; break; default: Xlog.i(TAG, "Incorrect sim id "); if (FeatureOption.MTK_GEMINI_SUPPORT) { Intent intent = new Intent(); intent.setClassName("com.android.phone", "com.mediatek.settings.MultipleSimActivity"); intent.putExtra("TARGET_CLASS", "com.android.settings.ApnSettings"); startActivity(intent); } finish(); break; } Xlog.d(TAG, "mNumeric " + mNumeric); Xlog.d(TAG, "mUri = " + mUri); }
@Override public void onClick(View v) { boolean newValue = !isChecked(); if (!newValue) { Xlog.d(TAG, "button.onClick return"); return; } if (setChecked(newValue)) { callChangeListener(newValue); Xlog.d(TAG, "button.onClick"); } }
public static void setPendingSmsFailed(final Context context) { Xlog.d(MmsApp.TXN_TAG, "setPendingSmsFailed"); Cursor cursor = SqliteWrapper.query( context, context.getContentResolver(), Sms.CONTENT_URI, new String[] {Sms._ID}, Sms.TYPE + "=" + Sms.MESSAGE_TYPE_OUTBOX + " OR " + Sms.TYPE + "=" + Sms.MESSAGE_TYPE_QUEUED, null, null); if (cursor != null) { try { int count = cursor.getCount(); Xlog.d(MmsApp.TXN_TAG, "setPendingSmsFailed: Message Size=" + count); if (count == 0) { return; } ContentValues values = null; int id = 0; while (cursor.moveToNext()) { id = cursor.getInt(0); Xlog.d(MmsApp.TXN_TAG, "setPendingSmsFailed: MsgId=" + id); values = new ContentValues(1); values.put(Sms.TYPE, Sms.MESSAGE_TYPE_FAILED); SqliteWrapper.update( context, context.getContentResolver(), Sms.CONTENT_URI, values, Sms._ID + "=" + id, null); } } catch (SQLiteDiskIOException e) { Xlog.e(MmsApp.TXN_TAG, "SQLiteDiskIOException caught while set sms failed", e); } finally { cursor.close(); } } else { Xlog.d(MmsApp.TXN_TAG, "setPendingSmsFailed: no pending messages."); } }
private void setSpn() { try { ITelephony telephony = ITelephony.Stub.asInterface(ServiceManager.getService(Context.TELEPHONY_SERVICE)); if (FeatureOption.MTK_GEMINI_SUPPORT) { mSpn = telephony.getSpNameInEfSpnGemini(mSimId); } else { mSpn = telephony.getSpNameInEfSpn(); } Xlog.d(TAG, "spn = " + mSpn); } catch (android.os.RemoteException e) { Xlog.d(TAG, "RemoteException"); } }
/** * Increases or decreases the brightness. * * @param context */ private void toggleBrightness(Context context) { try { IPowerManager power = IPowerManager.Stub.asInterface(ServiceManager.getService("power")); if (power != null) { ContentResolver cr = context.getContentResolver(); int brightness = Settings.System.getInt(cr, Settings.System.SCREEN_BRIGHTNESS); int brightnessMode = Settings.System.SCREEN_BRIGHTNESS_MODE_MANUAL; // Only get brightness setting if available if (context .getResources() .getBoolean(com.android.internal.R.bool.config_automatic_brightness_available)) { brightnessMode = Settings.System.getInt(cr, Settings.System.SCREEN_BRIGHTNESS_MODE); } // Rotate AUTO -> MINIMUM -> DEFAULT -> MAXIMUM // Technically, not a toggle... if (brightnessMode == Settings.System.SCREEN_BRIGHTNESS_MODE_AUTOMATIC) { brightness = MINIMUM_BACKLIGHT; brightnessMode = Settings.System.SCREEN_BRIGHTNESS_MODE_MANUAL; } else if (brightness < DEFAULT_BACKLIGHT) { brightness = DEFAULT_BACKLIGHT; } else if (brightness < MAXIMUM_BACKLIGHT) { brightness = MAXIMUM_BACKLIGHT; } else { brightnessMode = Settings.System.SCREEN_BRIGHTNESS_MODE_AUTOMATIC; brightness = MINIMUM_BACKLIGHT; } if (context .getResources() .getBoolean(com.android.internal.R.bool.config_automatic_brightness_available)) { // Set screen brightness mode (automatic or manual) Settings.System.putInt( context.getContentResolver(), Settings.System.SCREEN_BRIGHTNESS_MODE, brightnessMode); } else { // Make sure we set the brightness if automatic mode isn't available brightnessMode = Settings.System.SCREEN_BRIGHTNESS_MODE_MANUAL; } if (brightnessMode == Settings.System.SCREEN_BRIGHTNESS_MODE_MANUAL) { power.setBacklightBrightness(brightness); Settings.System.putInt(cr, Settings.System.SCREEN_BRIGHTNESS, brightness); } } } catch (RemoteException e) { Xlog.d(TAG, "toggleBrightness: " + e); } catch (Settings.SettingNotFoundException e) { Xlog.d(TAG, "toggleBrightness: " + e); } }
private void setIMSI() { try { ITelephony telephony = ITelephony.Stub.asInterface(ServiceManager.getService(Context.TELEPHONY_SERVICE)); if (FeatureOption.MTK_GEMINI_SUPPORT) { mIMSI = telephony.isOperatorMvnoForImsiGemini(mSimId); } else { mIMSI = telephony.isOperatorMvnoForImsi(); } Xlog.d(TAG, "IMSI = " + mIMSI); } catch (android.os.RemoteException e) { Xlog.d(TAG, "RemoteException"); } Xlog.d(TAG, "IMSI = " + mIMSI); }
public static synchronized IQuickSettingsPlugin getQuickSettingsPlugin(Context context) { if (mQuickSettingsPlugin == null) { mQuickSettingsPlugin = (IQuickSettingsPlugin) MPlugin.createInstance(IQuickSettingsPlugin.class.getName(), context); Xlog.d(TAG, "getQuickSettingsPlugin mQuickSettingsPlugin= " + mQuickSettingsPlugin); if (mQuickSettingsPlugin == null) { mQuickSettingsPlugin = new DefaultQuickSettingsPlugin(context); Xlog.d( TAG, "getQuickSettingsPlugin get DefaultQuickSettingsPlugin = " + mQuickSettingsPlugin); } } return mQuickSettingsPlugin; }
@Override protected void onCreate(Bundle icicle) { super.onCreate(icicle); addPreferencesFromResource(R.xml.apn_settings); getListView().setItemsCanFocus(true); mExt = Utils.getMiscPlugin(this); mRcseExt = Utils.getRcseApnPlugin(this); if (mRcseExt != null) { mRcseExt.addRcseOnlyApnStateChanged(mListener); } else { Xlog.d(TAG, "mApnPlugin is null"); } initSimState(); mMobileStateFilter = getIntentFilter(); mReceiver = getBroadcastReceiver(); mTelephonyManager = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE); mTelephonyManager.listen(mPhoneStateListener, PhoneStateListener.LISTEN_SERVICE_STATE); if (FeatureOption.MTK_MVNO_SUPPORT) { setSpn(); setIMSI(); setPnn(); } }
public void onItemSelected(AdapterView parent, View v, int pos, long id) { Message msg = mHandler.obtainMessage(EVENT_SET_NETWORKMODE_DONE); int settingsNetworkMode; if (mSimType == PhoneConstants.GEMINI_SIM_1) { settingsNetworkMode = android.provider.Settings.Global.getInt( getContentResolver(), android.provider.Settings.Global.PREFERRED_NETWORK_MODE, Phone.PREFERRED_NT_MODE); } else { settingsNetworkMode = android.provider.Settings.Global.getInt( getContentResolver(), android.provider.Settings.Global.PREFERRED_NETWORK_MODE_2, Phone.PREFERRED_NT_MODE); } int selectNetworkMode = mNetworkTypeValues[pos]; if (settingsNetworkMode != selectNetworkMode) { Xlog.d(TAG, "selectNetworkMode " + selectNetworkMode); if (FeatureOption.MTK_GEMINI_SUPPORT) { mGeminiPhone.setPreferredNetworkTypeGemini(selectNetworkMode, msg, mSimType); } else { mPhone.setPreferredNetworkType(selectNetworkMode, msg); } } }
private void setTextNumFormat(TextView textNumFormat, SimItem simItem) { if (simItem.mIsSim) { if (simItem.mNumber != null) { switch (simItem.mDispalyNumberFormat) { case DISPLAY_NONE: textNumFormat.setVisibility(View.GONE); break; case DISPLAY_FIRST_FOUR: textNumFormat.setVisibility(View.VISIBLE); if (simItem.mNumber.length() >= NUM_WIDTH) { textNumFormat.setText(simItem.mNumber.substring(0, NUM_WIDTH)); } else { textNumFormat.setText(simItem.mNumber); } break; case DISPLAY_LAST_FOUR: textNumFormat.setVisibility(View.VISIBLE); if (simItem.mNumber.length() >= NUM_WIDTH) { textNumFormat.setText( simItem.mNumber.substring(simItem.mNumber.length() - NUM_WIDTH)); } else { textNumFormat.setText(simItem.mNumber); } break; default: break; } } else { Xlog.d(TAG, "simItem.mNumber=" + simItem.mNumber); textNumFormat.setVisibility(View.GONE); } } else { textNumFormat.setVisibility(View.GONE); } }
private static boolean isDuplicateNotification(Context context, NotificationInd nInd) { byte[] rawLocation = nInd.getContentLocation(); if (rawLocation != null) { String location = new String(rawLocation); String selection = Mms.CONTENT_LOCATION + " = ?"; String[] selectionArgs = new String[] {location}; Cursor cursor = SqliteWrapper.query( context, context.getContentResolver(), Mms.CONTENT_URI, new String[] {Mms._ID}, selection, selectionArgs, null); if (cursor != null) { try { if (cursor.getCount() > 0) { cursor.moveToFirst(); Xlog.d(MmsApp.TXN_TAG, "duplicate, location=" + location + ", id=" + cursor.getLong(0)); // We already received the same notification before. return true; } } finally { cursor.close(); } } } return false; }
@Override public void onReceive(Context context, Intent intent) { SharedPreferences p = PreferenceManager.getDefaultSharedPreferences(context); SharedPreferences.Editor editor = p.edit(); if (null == intent.getExtras()) { return; } String searchEngineName = intent.getExtras().getString(BrowserSettings.PREF_SEARCH_ENGINE); String searchEngineFavicon = ""; ISearchEngineManager searchEngineManager = (ISearchEngineManager) context.getSystemService(Context.SEARCH_ENGINE_SERVICE); SearchEngineInfo searchEngineInfo = searchEngineManager.getSearchEngineByName(searchEngineName); if (searchEngineInfo != null) { searchEngineFavicon = searchEngineInfo.getFaviconUri(); } editor.putString(BrowserSettings.PREF_SEARCH_ENGINE, searchEngineName); editor.putString(BrowserSettings.PREF_SEARCH_ENGINE_FAVICON, searchEngineFavicon); editor.commit(); Xlog.d( XLOGTAG, "ChangeSearchEngineReceiver" + BrowserSettings.PREF_SEARCH_ENGINE + "---" + intent.getExtras().getString(BrowserSettings.PREF_SEARCH_ENGINE)); }
private boolean unzipInstallFile() { int result = -1; String updateZip = Util.getTempPath(this) + Util.PathName.PACKAGE_NAME; try { ZipFile updatePackage = new ZipFile(mPath); result = Util.unzipFileElement(updatePackage, UPDATE_PACKAGE_NAME, mUpdatePath); updatePackage.close(); Xlog.d(TAG, "[unzipInstallFile], unzip install.zip to googleota folder"); } catch (IOException e) { Xlog.e(TAG, "[unzipInstallFile], unzip file fail"); e.printStackTrace(); } Util.deleteFile(updateZip); if (result != Util.OTAresult.OTA_FILE_UNZIP_OK) { if (mHandler != null) { mHandler.sendEmptyMessage(SystemUpdateService.MSG_UNZIP_ERROR); } return false; } return true; }
@Override public void endData() { Xlog.d(XLOGTAG, "endData::mStatusCode is: " + mStatusCode + this); if (mStatusCode == 200) { if (mPosterBytes.size() > 0) { Bitmap poster = BitmapFactory.decodeByteArray(mPosterBytes.toByteArray(), 0, mPosterBytes.size()); mProxy.doSetPoster(poster); } cleanup(); } else if (mStatusCode >= 300 && mStatusCode < 400) { // We have a redirect. try { mUrl = new URL(mHeaders.getLocation()); } catch (MalformedURLException e) { mUrl = null; } if (mUrl != null) { mHandler.post( new Runnable() { @Override public void run() { if (mRequestHandle != null) { mRequestHandle.setupRedirect( mUrl.toString(), mStatusCode, new HashMap<String, String>()); } } }); } } }
@Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { Xlog.d(TAG, "oncheckChanged to " + isChecked); if (setChecked(isChecked)) { callChangeListener(isChecked); } }
@Override protected void notifyChanged() { super.notifyChanged(); Xlog.d(TAG, "notifyChanged"); if (!mBinding) { mPolicyEditor.setPolicyMetered(mTemplate, isChecked()); } }
private void setPnn() { if (FeatureOption.MTK_GEMINI_SUPPORT) { mPnn = mTelephonyManager.isOperatorMvnoForEfPnnGemini(mSimId); } else { mPnn = mTelephonyManager.isOperatorMvnoForEfPnn(); } Xlog.d(TAG, "Pnn = " + mPnn); }
@Override public void onStop() { super.onStop(); Xlog.d(TAG, "onStop, mSwitchBar removeOnSwitchChangeListener "); mSwitchBar.removeOnSwitchChangeListener(this); mSwitchBar.hide(); }