Skip to content

Commit f824699

Browse files
committed
Roll back changes of Bugzilla bug 443374 and Bugzilla bug 443367
Change-Id: Icf332d2e2bedeebb6d4b2766a26b09c2ad3ba58b Signed-off-by: zyang5e4 <zyyangbj@cn.ibm.com>
1 parent 371975c commit f824699

10 files changed

Lines changed: 5 additions & 383 deletions

File tree

org.eclipse.paho.android.service/org.eclipse.paho.android.service.sample/AndroidManifest.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
<uses-permission android:name="android.permission.INTERNET" />
1313
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
1414
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
15-
<uses-permission android:name="android.permission.GET_TASKS" />
1615

1716
<application
1817
android:allowBackup="true"

org.eclipse.paho.android.service/org.eclipse.paho.android.service.sample/src/org/eclipse/paho/android/service/sample/ClientConnections.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -306,9 +306,7 @@ private void connectAction(Bundle data) {
306306
}
307307
client.setCallback(new MqttCallbackHandler(this, clientHandle));
308308

309-
//setServiceNotificationCallback
310-
client.setServiceNotificationCallback(MyMqttServiceNtfCallback.class);
311-
309+
312310
//set traceCallback
313311
client.setTraceCallback(new MqttTraceCallback());
314312

org.eclipse.paho.android.service/org.eclipse.paho.android.service.sample/src/org/eclipse/paho/android/service/sample/MyMqttServiceNtfCallback.java

Lines changed: 0 additions & 44 deletions
This file was deleted.

org.eclipse.paho.android.service/org.eclipse.paho.android.service.test/AndroidManifest.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
<uses-permission android:name="android.permission.INTERNET" />
1111
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
1212
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
13-
<uses-permission android:name="android.permission.GET_TASKS" />
1413

1514
<instrumentation
1615
android:name="android.test.InstrumentationTestRunner"

org.eclipse.paho.android.service/org.eclipse.paho.android.service/src/org/eclipse/paho/android/service/DatabaseServiceNotificationCallbackStore.java

Lines changed: 0 additions & 165 deletions
This file was deleted.

org.eclipse.paho.android.service/org.eclipse.paho.android.service/src/org/eclipse/paho/android/service/MqttAndroidClient.java

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,6 @@ public void onServiceDisconnected(ComponentName name) {
144144
// The MqttCallback provided by the application
145145
private MqttCallback callback;
146146
private MqttTraceHandler traceCallback;
147-
private String serviceNTFCallbackCls;
148147

149148
//The acknowledgment that a message has been processed by the application
150149
private Ack messageAck;
@@ -417,15 +416,7 @@ private void doConnect() {
417416
}
418417
mqttService.setTraceEnabled(traceEnabled);
419418
mqttService.setTraceCallbackId(clientHandle);
420-
mqttService.setAppRunning(true);
421-
//store the app package name and service notification callback class
422-
if (this.serviceNTFCallbackCls!=null) {
423-
ServiceNotificationCallbackStore store=mqttService.getServiceNTFCallbackStore();
424-
if(store!=null) {
425-
store.setAppServiceNTFCallbackClass(mqttService.getApplicationInfo().packageName, serviceNTFCallbackCls);
426-
}
427-
}
428-
419+
429420
String activityToken = storeToken(connectToken);
430421
try {
431422
mqttService.connect(clientHandle, connectOptions, null,
@@ -1052,16 +1043,6 @@ public void setCallback(MqttCallback callback) {
10521043

10531044
}
10541045

1055-
/**
1056-
* Using this API, the end user can setup customized notification callback for MqttService
1057-
* This callback is only used when the applications is dead and the service is restarted
1058-
* @param callback is the Class which implements org.eclipse.paho.android.service.MqttServiceNotificationCallback
1059-
*/
1060-
public <T extends MqttServiceNotificationCallback> void setServiceNotificationCallback(Class<T> callback) {
1061-
this.serviceNTFCallbackCls=callback.getName();
1062-
Log.i("MqttAndroidClient","MqttService Notification Callback Class="+this.serviceNTFCallbackCls);
1063-
}
1064-
10651046
/**
10661047
* identify the callback to be invoked when making tracing calls back into
10671048
* the Activity

org.eclipse.paho.android.service/org.eclipse.paho.android.service/src/org/eclipse/paho/android/service/MqttConnection.java

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -860,28 +860,14 @@ public void messageArrived(String topic, MqttMessage message)
860860

861861
String messageId = service.messageStore.storeArrived(clientHandle,
862862
topic, message);
863-
864-
/**
865-
* if app is running, let's callback to activity if app is dead, let's
866-
* use service callback
867-
*/
868-
Log.i("MqttConnection","Get a message="+new String(message.getPayload()));
869-
//only if app running, call back to Activity
870-
if (service.isAppRunning()) {
863+
871864
Bundle resultBundle = messageToBundle(messageId, topic, message);
872865
resultBundle.putString(MqttServiceConstants.CALLBACK_ACTION,
873866
MqttServiceConstants.MESSAGE_ARRIVED_ACTION);
874867
resultBundle.putString(MqttServiceConstants.CALLBACK_MESSAGE_ID,
875868
messageId);
876869
service.callbackToActivity(clientHandle, Status.OK, resultBundle);
877-
}
878-
else {
879-
//otherwise, service will callback the service NTF callback
880-
Log.i("MqttConnection",
881-
"Notify message=" + new String(message.getPayload()));
882-
service.callbackToNotification(topic, message);
883-
}
884-
870+
885871
}
886872

887873
/**
@@ -988,7 +974,7 @@ synchronized void reconnect() {
988974
return;
989975
}
990976

991-
if (disconnected) {
977+
if (disconnected && !cleanSession) {
992978
// use the activityToke the same with action connect
993979
service.traceDebug(TAG,"Do Real Reconnect!");
994980
final Bundle resultBundle = new Bundle();

0 commit comments

Comments
 (0)