public void setCellLocation(CellLocation cellLocation) { this.cellLocation = cellLocation; for (PhoneStateListener listener : getListenersForFlags(LISTEN_CELL_LOCATION)) { listener.onCellLocationChanged(cellLocation); } }
private void initListener(PhoneStateListener listener, int flags) { if ((flags & LISTEN_CALL_STATE) != 0) { listener.onCallStateChanged(callState, incomingPhoneNumber); } if ((flags & LISTEN_CELL_INFO) != 0) { if (VERSION.SDK_INT >= JELLY_BEAN_MR1) { listener.onCellInfoChanged(allCellInfo); } } if ((flags & LISTEN_CELL_LOCATION) != 0) { listener.onCellLocationChanged(cellLocation); } }
@Test public void testListenInit() { PhoneStateListener listener = mock(PhoneStateListener.class); telephonyManager.listen(listener, LISTEN_CALL_STATE | LISTEN_CELL_INFO | LISTEN_CELL_LOCATION); verify(listener).onCallStateChanged(CALL_STATE_IDLE, null); verify(listener).onCellLocationChanged(null); if (VERSION.SDK_INT >= JELLY_BEAN_MR1) { verify(listener).onCellInfoChanged(Collections.emptyList()); } }
@Test public void shouldGiveCellLocation() { PhoneStateListener listener = mock(PhoneStateListener.class); telephonyManager.listen(listener, LISTEN_CELL_LOCATION); CellLocation mockCellLocation = mock(CellLocation.class); shadowOf(telephonyManager).setCellLocation(mockCellLocation); assertEquals(mockCellLocation, telephonyManager.getCellLocation()); verify(listener).onCellLocationChanged(mockCellLocation); }
@Override synchronized public void onCellLocationChanged(CellLocation location) { super.onCellLocationChanged(location); newSatisfiedState(match(location)); } }
public void setCellLocation(CellLocation cellLocation) { this.cellLocation = cellLocation; for (PhoneStateListener listener : getListenersForFlags(LISTEN_CELL_LOCATION)) { listener.onCellLocationChanged(cellLocation); } }
public void setCellLocation(CellLocation cellLocation) { this.cellLocation = cellLocation; for (PhoneStateListener listener : getListenersForFlags(LISTEN_CELL_LOCATION)) { listener.onCellLocationChanged(cellLocation); } }
@Override synchronized public void onCellLocationChanged(CellLocation location) { super.onCellLocationChanged(location); curr = CellLocationSingleData.fromCellLocation(location); changeSatisfiedState(eventData.contains(curr)); } }
private void initListener(PhoneStateListener listener, int flags) { if ((flags & LISTEN_CALL_STATE) != 0) { listener.onCallStateChanged(callState, incomingPhoneNumber); } if ((flags & LISTEN_CELL_INFO) != 0) { if (VERSION.SDK_INT >= JELLY_BEAN_MR1) { listener.onCellInfoChanged(allCellInfo); } } if ((flags & LISTEN_CELL_LOCATION) != 0) { listener.onCellLocationChanged(cellLocation); } }
private void initListener(PhoneStateListener listener, int flags) { if ((flags & LISTEN_CALL_STATE) != 0) { listener.onCallStateChanged(callState, incomingPhoneNumber); } if ((flags & LISTEN_CELL_INFO) != 0) { if (VERSION.SDK_INT >= JELLY_BEAN_MR1) { listener.onCellInfoChanged(allCellInfo); } } if ((flags & LISTEN_CELL_LOCATION) != 0) { listener.onCellLocationChanged(cellLocation); } }
@Override public void onCellLocationChanged(CellLocation location) { super.onCellLocationChanged(location);