Skip to content

Commit 239ff9d

Browse files
author
ted
committed
Merged release candidate with hotfix
2 parents 7ba627f + 4688b9a commit 239ff9d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+97
-18
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## v3.4-rc2 (2015-03-10)
2+
3+
### Fixed
4+
* Changed the implicit intents for starting services to explicit with the package as scope
5+
16
## v3.4-rc1 (2015-03-02)
27

38
### Added

sense-android-library/src/nl/sense_os/platform/SensePlatform.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,7 @@ public boolean addDataPoint(String sensorName, String displayName, String descri
198198
intent.putExtra(DataPoint.VALUE, (String) value);
199199
}
200200
intent.putExtra(DataPoint.TIMESTAMP, timestamp);
201+
intent.setPackage(mContext.getPackageName());
201202
ComponentName serviceName = mContext.startService(intent);
202203

203204
if (null != serviceName) {
@@ -255,6 +256,7 @@ public void close() {
255256
public boolean flushData() throws IllegalStateException {
256257
checkSenseService();
257258
Intent flush = new Intent(mContext.getString(R.string.action_sense_send_data));
259+
flush.setPackage(mContext.getPackageName());
258260
ComponentName started = mContext.startService(flush);
259261
return null != started;
260262
}

sense-android-library/src/nl/sense_os/service/AliveChecker.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ public void onReceive(Context context, Intent intent) {
4141
Log.v(TAG, "Sense should be alive: poke it");
4242
final Intent serviceIntent = new Intent(
4343
context.getString(R.string.action_sense_service));
44+
serviceIntent.setPackage(context.getPackageName());
4445
if (null == context.startService(serviceIntent)) {
4546
Log.w(TAG, "Could not start Sense service!");
4647
}

sense-android-library/src/nl/sense_os/service/BootRx.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ public void onReceive(Context context, Intent intent) {
3434
if (true == autostart) {
3535
Log.i(TAG, "Autostart Sense Platform service");
3636
Intent startService = new Intent(context.getString(R.string.action_sense_service));
37+
startService.setPackage(context.getPackageName());
3738
ComponentName service = context.startService(startService);
3839
if (null == service) {
3940
Log.w(TAG, "Failed to start Sense Platform service");

sense-android-library/src/nl/sense_os/service/DataTransmitter.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ public void stopTransmissions() {
150150
public void transmissionService() {
151151
Log.v(TAG, "Start transmission");
152152
Intent task = new Intent(mContext.getString(R.string.action_sense_send_data));
153+
task.setPackage(mContext.getPackageName());
153154
mLastTxTime = SystemClock.elapsedRealtime();
154155
ComponentName service = mContext.startService(task);
155156
if (null == service) {

sense-android-library/src/nl/sense_os/service/NetworkMonitor.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,11 @@ public void onReceive(final Context context, Intent intent) {
3535

3636
// check that we are not logged in yet before logging in
3737
if (false == state.isLoggedIn()) {
38-
Log.i(TAG, "Regained connectivity! Try to log in");
39-
context.startService(new Intent(context.getString(R.string.action_sense_service)));
38+
Log.i(TAG, "Regained connectivity! Try to log in");
39+
Intent i = new Intent(context.getString(R.string.action_sense_service));
40+
i.setPackage(context.getPackageName());
41+
context.startService(i);
42+
4043

4144
} else {
4245
// still connected, stay logged in

sense-android-library/src/nl/sense_os/service/SenseService.java

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -390,8 +390,12 @@ private void onLogOut() {
390390
transmitter.stopTransmissions();
391391

392392
// completely stop the MsgHandler service
393-
stopService(new Intent(getString(R.string.action_sense_new_data)));
394-
stopService(new Intent(getString(R.string.action_sense_send_data)));
393+
Intent newDataIntent = new Intent(getString(R.string.action_sense_new_data));
394+
newDataIntent.setPackage(getPackageName());
395+
stopService(newDataIntent);
396+
Intent sendDataIntent = new Intent(getString(R.string.action_sense_send_data));
397+
sendDataIntent.setPackage(getPackageName());
398+
stopService(sendDataIntent);
395399
}
396400

397401
void onSampleRateChange() {
@@ -484,7 +488,9 @@ void onSyncRateChange() {
484488
}
485489

486490
// update any widgets
487-
startService(new Intent(getString(R.string.action_widget_update)));
491+
Intent i = new Intent(getString(R.string.action_widget_update));
492+
i.setPackage(getPackageName());
493+
startService(i);
488494
}
489495

490496
/**
@@ -1229,7 +1235,9 @@ synchronized void toggleMain(boolean active) {
12291235
if (true == active) {
12301236
// properly start the service to start sensing
12311237
Log.i(TAG, "Start service");
1232-
startService(new Intent(getString(R.string.action_sense_service)));
1238+
Intent serviceIntent = new Intent(getString(R.string.action_sense_service));
1239+
serviceIntent.setPackage(getPackageName());
1240+
startService(serviceIntent);
12331241

12341242
} else {
12351243
Log.i(TAG, "Stop service");

sense-android-library/src/nl/sense_os/service/ServiceStateHelper.java

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -180,13 +180,17 @@ public boolean isStarted() {
180180
}
181181

182182
public void setAmbienceActive(boolean active) {
183-
ambienceActive = active;
184-
context.startService(new Intent(context.getString(R.string.action_widget_update)));
183+
ambienceActive = active;
184+
Intent i = new Intent(context.getString(R.string.action_widget_update));
185+
i.setPackage(context.getPackageName());
186+
context.startService(i);
185187
}
186188

187189
public void setDevProxActive(boolean active) {
188190
devProxActive = active;
189-
context.startService(new Intent(context.getString(R.string.action_widget_update)));
191+
Intent i = new Intent(context.getString(R.string.action_widget_update));
192+
i.setPackage(context.getPackageName());
193+
context.startService(i);
190194
}
191195

192196
public void setExternalActive(boolean active) {
@@ -201,12 +205,16 @@ public void setForeground(boolean foreground) {
201205
// : "Sense Platform Service is in background...");
202206
updateNotification();
203207
}
204-
context.startService(new Intent(context.getString(R.string.action_widget_update)));
208+
Intent i = new Intent(context.getString(R.string.action_widget_update));
209+
i.setPackage(context.getPackageName());
210+
context.startService(i);
205211
}
206212

207213
public void setLocationActive(boolean active) {
208214
locationActive = active;
209-
context.startService(new Intent(context.getString(R.string.action_widget_update)));
215+
Intent i = new Intent(context.getString(R.string.action_widget_update));
216+
i.setPackage(context.getPackageName());
217+
context.startService(i);
210218
}
211219

212220
public void setLoggedIn(boolean loggedIn) {
@@ -216,17 +224,23 @@ public void setLoggedIn(boolean loggedIn) {
216224
// : "Sense Platform Service logged out...");
217225
updateNotification();
218226
}
219-
context.startService(new Intent(context.getString(R.string.action_widget_update)));
227+
Intent i = new Intent(context.getString(R.string.action_widget_update));
228+
i.setPackage(context.getPackageName());
229+
context.startService(i);
220230
}
221231

222232
public void setMotionActive(boolean active) {
223233
motionActive = active;
224-
context.startService(new Intent(context.getString(R.string.action_widget_update)));
234+
Intent i = new Intent(context.getString(R.string.action_widget_update));
235+
i.setPackage(context.getPackageName());
236+
context.startService(i);
225237
}
226238

227239
public void setPhoneStateActive(boolean active) {
228240
phoneStateActive = active;
229-
context.startService(new Intent(context.getString(R.string.action_widget_update)));
241+
Intent i = new Intent(context.getString(R.string.action_widget_update));
242+
i.setPackage(context.getPackageName());
243+
context.startService(i);
230244
}
231245

232246
public void setQuizActive(boolean active) {
@@ -241,7 +255,9 @@ public void setStarted(boolean started) {
241255
// : "Sense Platform Service stopped...");
242256
updateNotification();
243257
}
244-
context.startService(new Intent(context.getString(R.string.action_widget_update)));
258+
Intent i = new Intent(context.getString(R.string.action_widget_update));
259+
i.setPackage(context.getPackageName());
260+
context.startService(i);
245261
}
246262

247263
/**

sense-android-library/src/nl/sense_os/service/ambience/AutoCalibratedNoiseSensor.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ private void sendSensorValue(double value, long ms) {
109109
sensorData.putExtra(DataPoint.VALUE, (float)value);
110110
sensorData.putExtra(DataPoint.DATA_TYPE, SenseDataTypes.FLOAT);
111111
sensorData.putExtra(DataPoint.TIMESTAMP, ms);
112+
sensorData.setPackage(context.getPackageName());
112113
context.startService(sensorData);
113114
}
114115
}

sense-android-library/src/nl/sense_os/service/ambience/CameraLightSensor.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ public void lightValueCallback(float lightValue, int camera_id) {
6363
i.putExtra(DataPoint.SENSOR_DESCRIPTION, sensorDescription);
6464
i.putExtra(DataPoint.DATA_TYPE, SenseDataTypes.JSON);
6565
i.putExtra(DataPoint.TIMESTAMP, dataPoint.timeStamp);
66+
i.setPackage(context.getPackageName());
6667
context.startService(i);
6768
// Log.e(TAG, "Sent new camera licht values, camera: "+camera_id+" value: "+lightValue);
6869
nextUpdate(camera_id);

0 commit comments

Comments
 (0)