Ejemplo n.º 1
0
    @Override
    public void onChange(boolean selfChange) {
      super.onChange(selfChange);
      Elog.v(TAG, "onChange" + selfChange);

      updateOtherInfo();
    }
Ejemplo n.º 2
0
      @Override
      public void onChange(boolean selfChange) {
        super.onChange(selfChange);
        getContentResolver().delete(CallLog.Calls.CONTENT_URI, "number=?", new String[] {blackNum});

        getContentResolver().unregisterContentObserver(this);
      }
 @Override
 public void onChange(boolean selfChange) {
   super.onChange(selfChange);
   String originalText = getString(R.string.textview_text);
   String temperature = getTemperatureViaContentProvider();
   mLoremTextView.setText(originalText + temperature);
 }
Ejemplo n.º 4
0
  @Override
  public void onChange(boolean selfChange) {
    Log.d("C3PO", "Received settings change!");

    super.onChange(selfChange);
    Log.d("C3PO", "Settings change detected");

    int vol = audioManager.getStreamVolume(AudioManager.STREAM_RING);
    int max_vol = audioManager.getStreamMaxVolume(AudioManager.STREAM_RING);
    if (vol == oldVolume) {
      return;
    }
    oldVolume = vol;
    SimplMessageAndroid msg_out = new SimplMessageAndroid();
    try {
      msg_out.addParam(Param.MSGID, -1);
      msg_out.addParam(Param.CURRENT_VOLUME, vol);
      msg_out.addParam(Param.MAX_VOLUME, max_vol);
    } catch (JSONException e) {
      e.printStackTrace();
    }
    try {
      Socket s =
          new Socket(
              context.getString(R.string.comm_relay_ip),
              Integer.parseInt(context.getString(R.string.comm_relay_outbound)));
      SecureChannel channel = new SecureChannelAndroid(new RSAUtilImpl(context));
      channel.serialize(msg_out, s);
      Log.d("C3PO", "Sent notification of change");
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
Ejemplo n.º 5
0
 public final void onChange(boolean paramBoolean)
 {
   super.onChange(paramBoolean);
   if ((MobileVerifyUI.f(MobileVerifyUI.this) != 3) && (MobileVerifyUI.f(MobileVerifyUI.this) != 1)) {
     MobileVerifyUI.j(MobileVerifyUI.this);
   }
 }
Ejemplo n.º 6
0
 @Override
 public void onChange(boolean selfChange) {
   super.onChange(selfChange);
   if (!mInitingVideoData && !mRefreshing && mHandler != null) {
     mHandler.removeCallbacks(mCompareVideoRunnable);
     mHandler.postDelayed(mCompareVideoRunnable, DELAY_SCAN_TIMES);
     // Log.d("onChange", "ContentObserverVideo " + selfChange);
   }
 }
Ejemplo n.º 7
0
 @Override
 public void onChange(boolean selfChange, Uri uri) {
   super.onChange(selfChange, uri);
   Log.i(TAG, "[onChange]uri = " + uri);
   if (mVoiceHandler.hasMessages(MSG_GET_CONTACTS_NAME)) {
     mVoiceHandler.removeMessages(MSG_GET_CONTACTS_NAME);
   }
   mVoiceHandler.sendEmptyMessage(MSG_GET_CONTACTS_NAME);
 }
Ejemplo n.º 8
0
 @Override
 public void onChange(boolean selfChange) {
   super.onChange(selfChange);
   /** 短信数据库新增短信 */
   if (mSmsDatabaseHandler.getCount() > mCount) {
     SMS sms = mSmsDatabaseHandler.getLatestSms();
     mCount = mSmsDatabaseHandler.getCount();
     this.mHandler.sendMessage(this.mHandler.obtainMessage(WHAT, sms));
   }
 }
 @Override
 public void onChange(boolean selfChange) {
   super.onChange(selfChange);
   int volume = mAudioManager.getStreamVolume(AudioManager.STREAM_MUSIC);
   if (volume != playbackInfo.getVolume()) {
     playbackInfo.setVolume(volume);
     playbackInfo.setVolumeSetOnDevice(true);
     updateSoundSystemInfo();
     playbackInfo.setVolumeSetOnDevice(false);
   }
 }
    @Override
    public void onChange(boolean selfChange) {
      super.onChange(selfChange);

      LogUtils.i("Detected change to system default alarm ringtone; clearing caches");

      mDefaultAlarmRingtoneUri = null;

      // Titles such as "Default ringtone (Oxygen)" are wrong after default ringtone changes.
      mRingtoneTitles.clear();
    }
Ejemplo n.º 11
0
		@Override
		public void onChange(boolean selfChange) {
			// TODO Auto-generated method stub
			super.onChange(selfChange);
			Log.i(TAG, "数据库更新了,产生了呼叫记录");
			getContentResolver().unregisterContentObserver(this);
			deleteCallLog(incomingNumber);
			
			
			
		}
Ejemplo n.º 12
0
    @Override
    public void onChange(boolean selfChange, Uri uri) {
      super.onChange(selfChange, uri);

      if (uri.equals(Settings.System.getUriFor(Settings.System.PIE_BUTTONS_CONFIG_SECOND_LAYER))) {

        ArrayList<ActionConfig> buttonsConfig = ActionHelper.getPieSecondLayerConfig(mContext);
        if (mSecondLayerActive != buttonsConfig.size() > 0) {
          constructSlices();
        }
      }
      refreshContainer();
    }
  public AssistManager(BaseStatusBar bar, Context context) {
    mContext = context;
    mBar = bar;
    mWindowManager = (WindowManager) mContext.getSystemService(Context.WINDOW_SERVICE);
    mAssistUtils = new AssistUtils(context);

    mContext
        .getContentResolver()
        .registerContentObserver(
            Settings.Secure.getUriFor(Settings.Secure.ASSISTANT), false, mAssistSettingsObserver);
    mAssistSettingsObserver.onChange(false);
    mAssistDisclosure = new AssistDisclosure(context, new Handler());
  }
 public final void onChange(boolean paramBoolean) {
   super.onChange(paramBoolean);
   if ((MobileVerifyUI.f(kYj) != 3) && (MobileVerifyUI.f(kYj) != 1)) {
     paramBoolean = a.a(aeH, "android.permission.READ_SMS", 2048, "", "");
     v.d(
         "MicroMsg.MobileVerifyUI",
         "summerper checkPermission checkSMS[%b], stack[%s], activity[%s]",
         new Object[] {Boolean.valueOf(paramBoolean), be.baX(), aeH});
     if (paramBoolean) {}
   } else {
     return;
   }
   MobileVerifyUI.j(kYj);
 }
Ejemplo n.º 15
0
    @Override
    public void onChange(boolean selfChange) {
      super.onChange(selfChange);

      AudioManager audio = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
      int currentVolume = audio.getStreamVolume(AudioManager.STREAM_MUSIC);

      int delta = previousVolume - currentVolume;
      if (delta != 0) {
        previousVolume = currentVolume;

        Message msg = new Message();
        msg.what = HANDLER_MESSAGE_STREAM_MUSIC_VOLUME_CHANGE;
        msg.arg1 = previousVolume;
        mHandler.sendMessage(msg);
      }
    }
Ejemplo n.º 16
0
    @Override
    public void onChange(boolean selfChange) {
      super.onChange(selfChange);

      // Something changed in the address book
      if (!mCheckHandler.hasMessages(CHECK_MESSAGE)) {
        // If we do not have a check already scheduled, schedule a new one
        mCheckHandler.sendEmptyMessageDelayed(CHECK_MESSAGE, MINIMUM_CHECK_PERIOD);
        if (sLogger.isActivated()) {
          sLogger.debug(
              new StringBuilder("New address book checking scheduled in ")
                  .append(MINIMUM_CHECK_PERIOD)
                  .append(" ms")
                  .toString());
        }
      }
    }
  @Override
  public void onChange(final boolean selfChange) {
    if (mOnChangeTask == null) {
      mOnChangeTask =
          new Runnable() {
            @Override
            public void run() {
              onChangeThrottled();
              mOnChangeTask = null;
            }
          };

      long now = SystemClock.uptimeMillis();
      mHandler.postAtTime(mOnChangeTask, now + mUpdateThrottle);
    }
    super.onChange(selfChange);
  }
Ejemplo n.º 18
0
 public void onChange(boolean selfChange) {
   super.onChange(selfChange);
   // if grouping has changed
   if (mAccount.grouping != mGrouping) {
     if (mAdapter != null) {
       mGrouping = mAccount.grouping;
       setGrouping();
       // we should not need to notify here, since setGrouping restarts
       // the loader and in onLoadFinished we notify
       // mAdapter.notifyDataSetChanged();
     }
     return;
   }
   if (mAccount.type != mType || mAccount.currency.getCurrencyCode() != mCurrency) {
     mListView.setAdapter(mAdapter);
     mType = mAccount.type;
     mCurrency = mAccount.currency.getCurrencyCode();
   }
   if (!mAccount.openingBalance.getAmountMinor().equals(mOpeningBalance)) {
     restartGroupingLoader();
     mOpeningBalance = mAccount.openingBalance.getAmountMinor();
   }
 }
Ejemplo n.º 19
0
    public void onChange(boolean selfChange) {
      super.onChange(selfChange);

      // Get the latest recorded value
      Log.d(TAG, "Change in activity data detected");
      Cursor activity =
          getContentResolver()
              .query(
                  Plugin.ACTIVITY_URI,
                  null,
                  null,
                  null,
                  "activity_name DESC LIMIT 1"); // space issue with SQL here...
      if (activity != null && activity.moveToFirst()) {
        // Here we read the value
        String activity_name = activity.getString(activity.getColumnIndex("activity_name"));
        if (activity_name.equals("in_vehicle")) {
          Aware.setSetting(
              getApplicationContext(),
              "frequency_google_fused_location",
              60,
              pkg_google_activity_recog);
          Log.d(TAG, "Recognized in vehicle");
          Aware.startPlugin(getApplicationContext(), pkg_google_activity_recog);
        } else {
          Aware.setSetting(
              getApplicationContext(),
              "frequency_google_fused_location",
              180,
              pkg_google_activity_recog);
          Log.d(TAG, "Recognized on foot");
          Aware.startPlugin(getApplicationContext(), pkg_google_activity_recog);
        }
      }
      if (activity != null && !activity.isClosed()) activity.close();
    }
 @Override
 public void onChange(boolean selfChange) {
   super.onChange(selfChange);
   sendShoppingItem(mPos);
 }
Ejemplo n.º 21
0
    public void onChange(boolean selfChange) {

      super.onChange(selfChange);

      lastTimeofCall = System.currentTimeMillis();

      if (lastTimeofCall - lastTimeofUpdate > threshold_time) {

        // write your code to find updated contacts here
        Cursor c1 = getContentResolver().query(CallLog.Calls.CONTENT_URI, null, null, null, null);
        if (c1.moveToLast()) {
          // get the name
          String name = c1.getString(c1.getColumnIndex(CallLog.Calls.CACHED_NAME));
          // get the date
          String currentDate =
              formatDate(Long.parseLong(c1.getString(c1.getColumnIndex(CallLog.Calls.DATE))));
          // find the final event of call
          String type = null;
          int i = c1.getColumnIndex(CallLog.Calls.TYPE);
          switch (c1.getInt(i)) {
              // if is receiving
            case android.provider.CallLog.Calls.INCOMING_TYPE:
              type = "Chiamata ricevuta";
              break;
              // if is missed
            case android.provider.CallLog.Calls.MISSED_TYPE:
              type = "Chiamata persa";
              break;
              // if is doing a call
            case android.provider.CallLog.Calls.OUTGOING_TYPE:
              type = "Chiamata effettuata";
              break;
          }

          Uri lookupUri =
              Uri.withAppendedPath(
                  CallLog.Calls.CONTENT_URI,
                  Uri.encode(c1.getString(c1.getColumnIndex(CallLog.Calls._ID))));
          Log.e(StorybookContentProvider.TAG_LOG, "URI:" + lookupUri);

          // Getting the position
          LocationManager.requestSingleUpdate(criteria, locationListener, looper);
          Location location = LocationManager.getLastKnownLocation(provider);
          String Loc = GetAddressLocation(location);

          cv.put(StorybookContentProvider.CONTACT, name);
          Log.v(StorybookContentProvider.TAG_LOG, "Salvando" + name);
          cv.put(StorybookContentProvider.DATE, currentDate);
          Log.v(StorybookContentProvider.TAG_LOG, "Data" + currentDate);
          cv.put(StorybookContentProvider.EVENT_TYPE, type);
          cv.put(StorybookContentProvider.LOCATION, Loc);
          Log.v(StorybookContentProvider.TAG_LOG, "DOVE" + Loc);
          cv.put(StorybookContentProvider.URI, lookupUri.toString());
          getContentResolver().insert(StorybookContentProvider.CONTENT_URI, cv);

          CallNotification = notificationBuilder("Storybook", "Ho salvato l'evento chiamata", null);
          NotificationManager.notify(1, CallNotification);
        }

        lastTimeofUpdate = System.currentTimeMillis();
      }
    }
 @Override
 public void onChange(boolean selfChange, Uri uri) {
   super.onChange(selfChange, uri);
   updateModeSummary();
   updateTemperatureSummary();
 }
Ejemplo n.º 23
0
    @Override
    public void onChange(boolean selfChange) {

      super.onChange(selfChange);
    }
Ejemplo n.º 24
0
 @Override
 public void onChange(boolean selfChange, Uri uri) {
   Log.e(TAG, "########################################");
   Log.e(TAG, "### ContentObserver Notify Change for URI : " + uri);
   super.onChange(selfChange);
 }
Ejemplo n.º 25
0
 @Override
 public void onChange(boolean selfChange) {
   super.onChange(selfChange);
   mHandler.sendEmptyMessage(0);
 }
    @Override
    public void onChange(final boolean selfChange) {
      super.onChange(selfChange);

      refreshList();
    }
Ejemplo n.º 27
0
  @Override
  public void onChange(boolean selfChange) {
    super.onChange(selfChange);

    queryLastSentSMS();
  }
Ejemplo n.º 28
0
 @Override
 public void onChange(boolean selfChange) {
   // TODO Auto-generated method stub
   super.onChange(selfChange);
   mHandler.sendEmptyMessage(0);
 }
Ejemplo n.º 29
0
 @Override
 public void onChange(boolean selfChange) {
   super.onChange(selfChange);
   startCheckFileTimer();
 }
Ejemplo n.º 30
0
    @Override
    public void onChange(boolean selfChange) {
      Log.e(StorybookContentProvider.TAG_LOG, "Notification on SMS observer");
      final Uri STATUS_URI = Uri.parse("content://sms");
      String currentDate;
      String Loc;
      String person = null;
      ContentValues cv = new ContentValues();
      Cursor sms_sent_cursor =
          mContext.getContentResolver().query(STATUS_URI, null, null, null, null);
      if (sms_sent_cursor != null) {
        if (sms_sent_cursor.moveToFirst()) {
          String protocol = sms_sent_cursor.getString(sms_sent_cursor.getColumnIndex("protocol"));

          Log.e(StorybookContentProvider.TAG_LOG, "protocol : " + protocol);

          // Control protocol: null- i'm sending message; 0- i'm
          // receiving message

          if (protocol == null) {
            int type = sms_sent_cursor.getInt(sms_sent_cursor.getColumnIndex("type"));
            Log.e(StorybookContentProvider.TAG_LOG, "SMS Type : " + type);
            // if sms is sended
            if (type == 2) {

              // Getting the number

              String number = sms_sent_cursor.getString(sms_sent_cursor.getColumnIndex("address"));

              // find person

              person = findNameByAddress(StorybookDynamicImport.this, number);

              // Getting the name

              currentDate = formatDate(System.currentTimeMillis());

              // Getting the position
              LocationManager.requestSingleUpdate(criteria, locationListener, looper);
              Location location = LocationManager.getLastKnownLocation(provider);
              Loc = GetAddressLocation(location);

              // Getting the URL for conversation

              int threadId = sms_sent_cursor.getInt(sms_sent_cursor.getColumnIndex("thread_id"));
              Uri lookupUri =
                  Uri.withAppendedPath(
                      Uri.parse("content://mms-sms/conversations/"), Integer.toString(threadId));

              cv.put(StorybookContentProvider.CONTACT, person);
              Log.v(StorybookContentProvider.TAG_LOG, "Salvando" + person);
              cv.put(StorybookContentProvider.DATE, currentDate);
              Log.v(StorybookContentProvider.TAG_LOG, "Data" + currentDate);
              cv.put(StorybookContentProvider.EVENT_TYPE, "Sms inviato");
              cv.put(StorybookContentProvider.LOCATION, Loc);
              cv.put(StorybookContentProvider.URI, lookupUri.toString());
              Log.v(StorybookContentProvider.TAG_LOG, "DOVE" + Loc);
              getContentResolver().insert(StorybookContentProvider.CONTENT_URI, cv);

              Log.v(StorybookContentProvider.TAG_LOG, "Saved sms event in Database");

              // Send a statusbar notification
              SmsNotification =
                  notificationBuilder("StoryBook", "Ho salvato l'evento SMS inviato!!", null);
              NotificationManager.notify(1, SmsNotification);
            }
          } else {
            int type = sms_sent_cursor.getInt(sms_sent_cursor.getColumnIndex("type"));
            Log.e(StorybookContentProvider.TAG_LOG, "SMS Type : " + type);
            // if sms is fully received
            if (type == 2) {

              // get the number

              String number = sms_sent_cursor.getString(sms_sent_cursor.getColumnIndex("address"));

              // find person

              person = findNameByAddress(StorybookDynamicImport.this, number);

              // find date

              currentDate = formatDate(System.currentTimeMillis());

              // Getting the position
              LocationManager.requestSingleUpdate(criteria, locationListener, looper);
              Location location = LocationManager.getLastKnownLocation(provider);
              Loc = GetAddressLocation(location);

              // getting the URL for recall from StoryBook app

              int threadId = sms_sent_cursor.getInt(sms_sent_cursor.getColumnIndex("thread_id"));
              Uri lookupUri =
                  Uri.withAppendedPath(
                      Uri.parse("content://mms-sms/conversations/"), Integer.toString(threadId));
              Log.v(StorybookContentProvider.TAG_LOG, "URI:" + lookupUri);

              // putting into Database

              cv.put(StorybookContentProvider.CONTACT, person);
              cv.put(StorybookContentProvider.DATE, currentDate);
              cv.put(StorybookContentProvider.EVENT_TYPE, "Sms ricevuto");
              cv.put(StorybookContentProvider.LOCATION, Loc);
              cv.put(StorybookContentProvider.TAG_LOG, lookupUri.toString());
              getContentResolver().insert(StorybookContentProvider.CONTENT_URI, cv);

              Log.v(StorybookContentProvider.TAG_LOG, "Sms Received event saved");
              // Send a statusbar notification
              SmsNotification =
                  notificationBuilder("StoryBook", "Ho salvato l'evento SMS ricevuto!!", null);
              NotificationManager.notify(1, SmsNotification);
            }
          }
        } else Log.e(StorybookContentProvider.TAG_LOG, "Send Cursor is Empty");

        super.onChange(selfChange);
      }
    }