i9305 not wokring 2G network in Android 5.1 - Galaxy S III Q&A, Help & Troubleshooting

Hi,
I have a problem with 2G (edge, I didn`t try GPRS) networks on my i9305 in Android 5.1. I can connect to 3G and 4G without problem, but for 2G I get only an exclamation mark on the side of the signal icon and no connection. I tried several ROMs, which I found here and my own cm12.1 build (I actually started with that one) - all with the same result:
AOSP-5.1.1-20150605-i9305-rodman01.zip
BlissPop-v4.0.3-i9305-UNOFFICIAL-20151011-2232.zip
LS-LP-v4.1-2015-10-23-liquid_i9305.zip
Sammy_Resurrection-Remix-LP-v5.5.9-20151122-i9305.zip
cm-12.1-20151201-UNOFFICIAL-i9305.zip (from winxuser)
I did some debugging and discovered that the problem is in wrong data coming from rild. I described it with more details here: forum.cyanogenmod.org/topic/118467-how-to-debug-non-working-2g-network I even found on the web some logs with the same wrong value and posts describing similar or the same behavior. I also found some posts saying, that it is fixed, but I can`t find any ROM, where it is working.
As you can see in my post on cyanogenmod forum, I have a solution, but not a nice one. It is a hack. So I want to ask – is there someone who had the same problem and fixed it? Or some who has the same phone and not this problem? If yes, how did you fix it? Exactly which ROM, prorietary files did you use?
Thank you
Pavel

OK, I am giving up. I tried several more ROMs:
Slim-i9305-5.1.1.beta.0.9-UNOFFICIAL-20151024-2015.zip
aicp_i9305_lp-10.0-NIGHTLY-20151128.zip
cm-12.1-20151202-UNOFFICIAL-i9305.zip
nameless-5.1.1-20151019-i9305-NIGHTLY.zip
The result is still the same. Maybe it has something to do with carrier operator (but I don`t have this problem in cm 11). I found fix similar to mine, which I described in cyanogenmod forum, so I`ll use that. See here github.com/CyanogenMod/android_device_samsung_jf-common/blob/cm-12.1/ril/telephony/java/com/android/internal/telephony/jflteRIL.java if you are interested. Specifically method responseVoiceDataRegistrationState. It replaces the wrong rild data in the same way.

I have the same problem @p.a.n.
Please tell me how I fix it, even if it´s a hack... Thanks

Hi,
here is the final diff I use:
Code:
project device/samsung/smdk4412-qcom-common/
diff --git a/ril/telephony/java/com/android/internal/telephony/smdk4x12QComRIL.java b/ril/telephony/java/com/android/internal/telephony/smdk4x12QComRIL.java
index 0e8d798..619be34 100644
--- a/ril/telephony/java/com/android/internal/telephony/smdk4x12QComRIL.java
+++ b/ril/telephony/java/com/android/internal/telephony/smdk4x12QComRIL.java
@@ -409,8 +409,8 @@ public class smdk4x12QComRIL extends RIL implements CommandsInterface {
case RIL_REQUEST_UDUB: ret = responseVoid(p); break;
case RIL_REQUEST_LAST_CALL_FAIL_CAUSE: ret = responseInts(p); break;
case RIL_REQUEST_SIGNAL_STRENGTH: ret = responseSignalStrength(p); break;
- case RIL_REQUEST_VOICE_REGISTRATION_STATE: ret = responseVoiceDataRegistrationState(p); break;
- case RIL_REQUEST_DATA_REGISTRATION_STATE: ret = responseVoiceDataRegistrationState(p); break;
+ case RIL_REQUEST_VOICE_REGISTRATION_STATE: ret = responseVoiceDataRegistrationState(p,false); break;
+ case RIL_REQUEST_DATA_REGISTRATION_STATE: ret = responseVoiceDataRegistrationState(p,true); break;
case RIL_REQUEST_OPERATOR: ret = operatorCheck(p); break;
case RIL_REQUEST_RADIO_POWER: ret = responseVoid(p); break;
case RIL_REQUEST_DTMF: ret = responseVoid(p); break;
@@ -580,9 +580,16 @@ public class smdk4x12QComRIL extends RIL implements CommandsInterface {
}
private Object
- responseVoiceDataRegistrationState(Parcel p) {
+ responseVoiceDataRegistrationState(Parcel p, boolean data) {
String response[] = (String[])responseStrings(p);
if (isGSM){
+ if(data &&
+ response.length > 4 &&
+ response[0] != null && response[0].equals("1") &&
+ response[3] != null && response[3].equals("102")){
+ riljLog("responseVoiceDataRegistrationState overriding 102 -> 2");
+ response[3]="2";
+ }
return response;
}
if (response.length>=10){
Or you can try replace /system/framework/telephony-common.jar with attached telephony-common.jar, but be careful with that (make backup), I can`t guarantee that it will work with the rest of your system.

Related

Getting IMEI within an EVC program

Does anyone know how to programmatically read the IMEI using embedded visual C. I have tried the TAPI lineGetGeneralInfo function but this always seems to return an error, as it requires TAPI extensions which don't seem to work. Is there any other function or API which returns this info?
Any help would be appreciated.
You need to use the SimGetRecordInfo() function. The IMEI is stored at address 0x6F07.
Steve
Thanks,
However this is the Sim's IMSI (International Mobile Subs Identifier) which identifies the country and home network. I am trying to get the phone's IMEI which is the electronic serial no of the phone (to use as part of a secure https validation procedure).
IMEI Code
#include <TAPI.h>
#include <ExTAPI.h>
#define TAPI_VERSION_1_0 0x00010003
#define TAPI_VERSION_1_4 0x00010004
#define TAPI_VERSION_2_0 0x00020000
void CALLBACK lineCallbackFunc(DWORD dwDevice, DWORD dwMsg, DWORD dwCallbackInstance, DWORD dwParam1, DWORD dwParam2, DWORD dwParam3);
void GetError(DWORD dwReturn);
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow)
{
HLINEAPP hLineAp = NULL;
DWORD dwNumDevs, dwDeviceID = 2;
HLINE hLine = NULL;
int i;
WCHAR szIMSI[180];
WCHAR szIMEI[180];
WCHAR szOutput[50];
LINEGENERALINFO lpLineInfo;
DWORD dwReturn, dwAPIVersion = TAPI_CURRENT_VERSION;
lineInitialize(&hLineAp, hInstance, lineCallbackFunc, NULL, &dwNumDevs);
lineNegotiateExtVersion(hLineAp, dwDeviceID, TAPI_VERSION_1_0, TAPI_CURRENT_VERSION, dwAPIVersion, NULL);
lineOpen(hLineAp, dwDeviceID, &hLine, dwAPIVersion, 0, 0, LINECALLPRIVILEGE_NONE, 0, 0);
lpLineInfo.dwTotalSize = 180;
dwReturn = lineGetGeneralInfo(hLine, &lpLineInfo);
if (!dwReturn)
{
if (lpLineInfo.dwSubscriberNumberSize > 2)
{
for (i = 0; i < (signed) lpLineInfo.dwSubscriberNumberSize/2; i++)
szIMSI = *((unsigned short *)(&lpLineInfo) + i + lpLineInfo.dwSubscriberNumberOffset/2);
szIMSI=NULL;
MessageBox(NULL,szIMSI,_T(" IMSI"),MB_OK);
}
else
if (lpLineInfo.dwSubscriberNumberSize)
MessageBox(NULL,_T("Please Enter PIN"),_T(" IMSI"),MB_OK);
else
MessageBox(NULL,_T("No SIM Card Present"),_T(" IMSI"),MB_OK);
for (i = 0; i < (signed) (lpLineInfo.dwSerialNumberSize/2); i++)
szIMEI = *((unsigned short *)(&lpLineInfo) + i + lpLineInfo.dwSerialNumberOffset/2);
szIMEI=NULL;
wsprintf(szOutput,_T("NULL"));
MessageBox(NULL,szIMEI,_T(" IMEI"),MB_OK);
}
else
GetError(dwReturn);
lineClose(hLine);
lineShutdown(hLineAp);
return 0;
}
void CALLBACK lineCallbackFunc(DWORD dwDevice, DWORD dwMsg, DWORD dwCallbackInstance, DWORD dwParam1, DWORD dwParam2, DWORD dwParam3)
{
}
void GetError(DWORD dwReturn)
{
switch (dwReturn)
{
case LINEERR_RESOURCEUNAVAIL:
MessageBox(NULL,_T("No SIM Card"),_T("Error"),MB_OK);
break;
case LINEERR_INVALLINEHANDLE:
MessageBox(NULL,_T("Line Unavailable"),_T(" Error"),MB_OK);
break;
case LINEERR_STRUCTURETOOSMALL:
MessageBox(NULL,_T("Oops"),_T(" Error"),MB_OK);
break;
case LINEERR_INVALPOINTER:
MessageBox(NULL,_T("Line Pointer Unavailable"),_T(" Error"),MB_OK);
break;
case LINEERR_UNINITIALIZED:
MessageBox(NULL,_T("Radio Not Turned On"),_T(" Error"),MB_OK);
break;
case LINEERR_NOMEM:
MessageBox(NULL,_T("Out of Memory"),_T(" Error"),MB_OK);
break;
case LINEERR_OPERATIONUNAVAIL:
MessageBox(NULL,_T("Unavailable"),_T(" Error"),MB_OK);
break;
case LINEERR_OPERATIONFAILED:
MessageBox(NULL,_T("Please Turn Radio On"),_T(" Error"),MB_OK);
break;
default:
MessageBox(NULL,_T("Error"),_T(" Error"),MB_OK);
}
}
Works great
Thanks
hi all, i tried to above code but it gave me thos following error !
any one can help me plz ?
unresolved external symbol lineGetGeneralInfo referenced in function WinMain
thankx alot
hi alla again
these is nothing wrong else that i forgot to like the cellcore.lib lbrary to my project
the code compiled but it gave me the result of " Unavailable " !
so how do i can get the IMEI ?
i'm using ROM 3.16.13 ENG
best regards
Essa
Two possible answers:
A: Turn the phone on
B: HTC have changed the memory map allocation
I have some debug code behind the stuff I posted earlier to dump the entire contents of the lpLineInfo struct. i'l try and see what teh problem is.
On previous versions they omitted the IMEI or extended the HW id sections.
vpreHoose thanx alot for ur replay..
ur code is working fine the problem is that i didnt load the cellcore.lib for the evc compiler and the other problem is the DeviceID
in ur code u r using DeviceID = 2 while me i must use DeviceID = 0,
so i changed dwDeviceID = 2 to dwDeviceID = 0; and every thing is working fine
can u tell me how do i can get the caller number while mobile ringing ?
i would like to develope a software that assigne a ringing tone to each contact number.
thanx alot
Yea, I was a little bit lazy not to write it to loop through all deviceid's...
:roll:
Thanks very much to the person who provided the code. I'd been battling with lineGetGeneralStatus for days, no joy. Microsoft giving away nothing here. I found the missing line in my code from yours:
lpLineInfo.dwTotalSize = 180;
And now it works. If only MS had stated this, would have solved me a whole load of hastle.
There must be more and useful information on the ExTapi. Like how to use the functions so that they work. Does anybody have a reference??
Ben
I tried this code on my qtek 2020 but my application return the following error:
unavailable
why???
a favor to ask
can anyone convert the code to c#? would be much appreciated
Re: IMEI Code
will this code work in an emulator?
test
lollone said:
I tried this code on my qtek 2020 but my application return the following error:
unavailable
why???
Click to expand...
Click to collapse
I got the same problem, and then changed the value of dwDeviceID to 0
DWORD dwDeviceID = 0;
and now i get an another error:
Please Turn Radio On
Click to expand...
Click to collapse
while I am a Newbie with XDA, so i want to ask, what is the Radio and how to turn it on?
thanks a lot
Pai
pai said:
lollone said:
I tried this code on my qtek 2020 but my application return the following error:
unavailable
why???
Click to expand...
Click to collapse
I got the same problem, and then changed the value of dwDeviceID to 0
DWORD dwDeviceID = 0;
and now i get an another error:
Please Turn Radio On
Click to expand...
Click to collapse
while I am a Newbie with XDA, so i want to ask, what is the Radio and how to turn it on?
thanks a lot
Pai
Click to expand...
Click to collapse
I have solved this problem by only restart, i think the radio means Handy-Net
Smart phones ?
This method doesn't work on smart phones?!
On WM 2003 Smart phone it always gives unsupported operation

[Q] own global settings (Settings.System)

Hi all,
I am currently doing some changes to the CM7-Framework and therefore need a custom option.
I wrote a simple app to test it and it doesn't work. The app has 3 Buttons
turnOn, turnOff and check
and one TextView for output.
Clicking turnOn does:
Code:
boolean success = Settings.System.putInt(getContentResolver(), "USE_BUTTONS_ON_NOTIFICATON", 1);
textView1.setText("set USE_BUTTONS_ON_NOTIFICATION to 1, success: " + success);
Clicking turnOff does:
Code:
boolean success = Settings.System.putInt(getContentResolver(), "USE_BUTTONS_ON_NOTIFICATON", 0);
textView1.setText("set USE_BUTTONS_ON_NOTIFICATION to 0, success: " + success);
and check does:
Code:
try {
int value = Settings.System.getInt(getContentResolver(), "USE_BUTTONS_ON_NOTIFICATION");
textView1.setText("USE_BUTTONS_ON_NOTIFICATION is: " + value);
} catch (SettingNotFoundException e) {
textView1.setText("Setting not found");
e.printStackTrace();
}
Both buttons return true, but check always says that the option is 1.
Is it even possible to change Settings like this? The app has the WRITE_SETTINGS permission.
If it is not possible, what would be a good way to ìmplement an option set by an app and read by a class inside the framework?

[Q] Need help hijacking/hooking/wrapping kernel function

I've made some modifications to drivers/usb/otg/msm_otg.c in order to support usb host mode for the Nexus 4: http://forum.xda-developers.com/showthread.php?t=2181820
So far, I've been building off Franco's sources, since I was using his kernel anyway. But this has its problems. I'm not looking to have to constantly keep up with Franco's nightlies. A good amount of posts from people are asking if I could compile a different kernel with the otg modifications, or if they could flash a different kernel on top. Franco's been getting requests to implement the modifications, and I didn't mean to put any onus on him.
I've been trying to do some research on creating a kernel module that could somehow hijack/hook/wrap the static functions I've made changes to in msm_otg.c. This is all way, way over my head though, and I could really use some help here. I've done some reading so far, but it hasn't gotten me anywhere. I got some good help on IRC, but am stuck again.
To get things rolling, I've manually found the address from /proc/kallsyms of static function msm_chg_detect_work to be 0xc03b4950. I'm trying to make a jump from here to my own function. I was provided make_jump_op for this purpose, although I have no understanding of how it works. Here is more or less what I've got so far (relevant bits..):
Code:
// max distance: 0x02000000
unsigned int make_jump_op(unsigned int src, unsigned int dst) {
unsigned int o;
int distance;
distance = (int)( ((long long)dst) - (((long long)src) + 8) );
if (distance > 32*1024*1024 || distance < -32*1024*1024) {
printk(KERN_ERR "distance too big!\n");
return 0; // crash, BOOOOM!
}
distance = distance / 4; // read: ">>2"
o = *((unsigned int *)(&distance)); // is there a proper way to do this, too?
o = (o & 0x00ffffff) + 0xea000000;
return o;
}
static void msm_chg_detect_work_MOD(struct work_struct *w) {
printk(KERN_INFO "TEST\n");
}
static int ziddey_otg_init(void) {
unsigned int *origcall;
printk(KERN_INFO "Loading kernel module '%s'\n", MODULE_NAME);
// 0xc03b4950: msm_chg_detect_work
origcall = (unsigned int *) 0xc03b4950;
preempt_disable();
*origcall = make_jump_op(0xc03b4950, (unsigned int)(void*)msm_chg_detect_work_MOD);
preempt_enable();
printk(KERN_INFO "Loaded kernel module '%s'\n", MODULE_NAME);
return 0;
}
Can anyone make sense of this? I get an Oops error and kernel panic.
Thank you
Code:
$ grep msm_chg_detect_work /proc/kallsyms
c03b4950 t msm_chg_detect_work

[Q] prevent android from storing plain text wifi passwords [solved]

Hey,
a few months ago I read somewhere that android stores the wifi passwords in plain text (seems to be known since 2010: http://forum.xda-developers.com/showthread.php?t=794555 but no one cares?!)
Because I don't want my wifi password to be stored that way, I searched for a way to store the wpa passphrase. This wasn't difficult, because android usese wpa_supplicant, means I just had to find out my passphrase and replace the plain key in /data/misc/wifi/wpa_supplicant.conf with it. Everything still works fine and my phone is able to connect to wifi.
Now my question is: is there a way to store every new wifi password this way? It's annoying to have to edit the wpa_supplicant.conf file manually...
One problem is, that it seems like android doesn't have the wpa_passphrase binary included, even if the source code seems to exist in the wpa_supplicant repository ( https://android.googlesource.com/platform/external/wpa_supplicant_6/ ).
If someone could tell me, how to build the code (I'm not familiar with the ndk), I could try writing an app, which replaces all plain text passwords with the passphrases.
But it would be awesome, if it were possible to integrate this feature in a custom rom, so no more passwords are stored plain text.
Best regards,
David
Finally, I was able to build CarbonRom from source and found a way to integrate this in the rom! On my device, no wifi password is stored in plain text anymore It took a long time to figure out what file I have to change but finally, I got it
If you are interested, I could create a patch and post it here but I don't know how to submit patches to github.
The only thing that confuses me: I found out, that the SSID I use to generate the password hash is quoted. Means, ThisIsASSID is stored as "ThisIsASSID". But actually the password hash should be wrong because it doesn't use ThisIsASSID. Anyway, it works And the password in wpa_supplicant.conf is hashed.
Edit: Cheered too soon... The wpa_supplicant.conf is probably just read at boot time. After a reboot I couldn't connect to my wifi anymore... But if I change the hash in the wpa_supplicant.conf file manually to the right one it works, so now I have to solve the quoting thing. But that shouldn't be difficult.
So, all problems solved now
Here is a patch I created, if anyone is interested:
PHP:
--- original/external/wpa_supplicant_8/wpa_supplicant/config_file.c 2013-08-15 00:12:50.000000000 +0200
+++ carbon/external/wpa_supplicant_8/wpa_supplicant/config_file.c 2013-08-15 01:09:21.876028461 +0200
@@ -19,6 +19,7 @@
#include "p2p/p2p.h"
#include "eap_peer/eap_methods.h"
#include "eap_peer/eap.h"
+#include "crypto/sha1.h"
static int newline_terminated(const char *buf, size_t buflen)
@@ -483,10 +484,36 @@
static void write_psk(FILE *f, struct wpa_ssid *ssid)
{
+ unsigned char psk[32];
char *value = wpa_config_get(ssid, "psk");
- if (value == NULL)
+ char *s = wpa_config_get(ssid, "ssid");
+ if(value == NULL || s == NULL)
return;
- fprintf(f, "\tpsk=%s\n", value);
+ int slen = os_strlen(s);
+ int plen = os_strlen(value);
+ int pskquoted = (value[0] == '"' && value[plen - 1] == '"') ? 1 : 0;
+ int i;
+ //if passphrase length is 64 it's already hashed as well as hashed passphrases aren't quoted
+ if( pskquoted == 1 || plen < 64){
+ //Check for quotes and remove if necessary
+ if(s[slen - 1] == '"' && s[0] == '"') {
+ s[slen - 1] = '\0';
+ s++;
+ }
+ if(pskquoted == 1) {
+ value[plen - 1] = '\0';
+ value++;
+ }
+ //Hash passphrase
+ pbkdf2_sha1(value, (u8 *) s, os_strlen(s), 4096, psk, 32);
+ fprintf(f, "\tpsk=");
+ for (i = 0; i < 32; i++)
+ fprintf(f, "%02x", psk[i]);
+ fprintf(f, "\n");
+ } else {
+ fprintf(f, "\tpsk=%s\n", value);
+ }
+ os_free(s);
os_free(value);
}
I didn't found a place in the java code so I directly edited the c code of wpa_supplicant

[XPOSED] [KK] [FIX] KitKat BUGS fixer

============== FIXES ==============
1. https://android-review.googlesource.com/#/c/81970/
Head: All service returning START_STICKY do not restart after it is being killed.
Symptom: if you will start heavy application (game, video encode/decode viewing or bad application which occupy lot of resources), android can kill background service, for example Skype or WhatsApp, but will never restart services when resources become free. Need to start application again or even full phone restart.
Affected version: 4.4, 4.4.1, and 4.4.2.
2. https://android-review.googlesource.com/#/c/98918/
Head: If all activities of a given stack were finishing, no activity was marked as front-of-task.
Symptom: if recents has several apps running, clicking BACK button fast to close current activity will bring to front another activity.
Affected version: 4.4.*
Mod does not have any settings activity. Just enabled it in Xposed menu.
INSTRUCTIONS:
if you get boot-loop
1. after phone start go to Xposed and immediately uncheck module.
2. issue command adb logcat > logcat.txt
3. phone will reboot again soon
4. upload logcat somewhere and post link here.
5. After next restart mod will be disabled.
6. Wait when I will publish correction.
Can be downloaded through Xposed Installer or here: http://repo.xposed.info/module/kz.virtex.android.issue63793fix
Source code:
Code:
package kz.virtex.android.issue63793fix;
import android.content.pm.ApplicationInfo;
import android.os.SystemClock;
import android.util.EventLog;
import android.util.Slog;
import com.android.server.am.EventLogTags;
import de.robv.android.xposed.IXposedHookZygoteInit;
import de.robv.android.xposed.XC_MethodReplacement;
import de.robv.android.xposed.XposedHelpers;
public class XMain implements IXposedHookZygoteInit
{
@Override
public void initZygote(StartupParam startupParam) throws Throwable
{
final Class<?> ActiveServices = XposedHelpers.findClass("com.android.server.am.ActiveServices", null);
XposedHelpers.findAndHookMethod(ActiveServices, "killServicesLocked", "com.android.server.am.ProcessRecord", "boolean", new XC_MethodReplacement()
{
@Override
protected Object replaceHookedMethod(MethodHookParam param) throws Throwable
{
Boolean DEBUG_SERVICE = (Boolean) XposedHelpers.getStaticBooleanField(ActiveServices, "DEBUG_SERVICE");
String TAG = (String) XposedHelpers.getStaticObjectField(ActiveServices, "TAG");
Object app = param.args[0];
boolean allowRestart = (Boolean) param.args[1];
Object services = XposedHelpers.getObjectField(app, "services");
int size = (Integer) XposedHelpers.callMethod(services, "size");
// First clear app state from services.
for (int i = size - 1; i >= 0; i--) {
Object sr = XposedHelpers.callMethod(services, "valueAt", i);
Object stats = XposedHelpers.getObjectField(sr, "stats");
synchronized (XposedHelpers.callMethod(stats, "getBatteryStats")) {
XposedHelpers.callMethod(stats, "stopLaunchedLocked");
}
Object sr_app = XposedHelpers.getObjectField(sr, "app");
Boolean persistent = XposedHelpers.getBooleanField(sr_app, "persistent");
Boolean stopIfKilled = XposedHelpers.getBooleanField(sr, "stopIfKilled");
if (sr_app != null && !persistent && stopIfKilled) {
Object sr_app_services = XposedHelpers.getObjectField(sr_app, "services");
XposedHelpers.callMethod(sr_app_services, "remove", sr);
}
XposedHelpers.setObjectField(sr, "app", null);
XposedHelpers.setObjectField(sr, "isolatedProc", null);
XposedHelpers.setObjectField(sr, "executeNesting", 0);
XposedHelpers.callMethod(sr, "forceClearTracker");
Object mDestroyingServices = XposedHelpers.getObjectField(param.thisObject, "mDestroyingServices");
Boolean check = (Boolean) XposedHelpers.callMethod(mDestroyingServices, "remove", sr);
if (check) {
if (DEBUG_SERVICE)
Slog.v(TAG, "killServices remove destroying " + sr);
}
Object bindings = XposedHelpers.getObjectField(sr, "bindings");
final int numClients = (Integer) XposedHelpers.callMethod(bindings, "size");
for (int bindingi = numClients - 1; bindingi >= 0; bindingi--) {
Object IntentBindRecord = XposedHelpers.callMethod(bindings, "valueAt", bindingi);
if (DEBUG_SERVICE)
Slog.v(TAG, "Killing binding " + IntentBindRecord + ": shouldUnbind=" + XposedHelpers.getObjectField(IntentBindRecord, "hasBound"));
XposedHelpers.setObjectField(IntentBindRecord, "binder", null);
XposedHelpers.setObjectField(IntentBindRecord, "requested", false);
XposedHelpers.setObjectField(IntentBindRecord, "received", false);
XposedHelpers.setObjectField(IntentBindRecord, "hasBound", false);
}
}
// Clean up any connections this application has to other
// services.
Object connections = XposedHelpers.getObjectField(app, "connections");
size = (Integer) XposedHelpers.callMethod(connections, "size");
for (int i = size - 1; i >= 0; i--) {
Object ConnectionRecord = XposedHelpers.callMethod(connections, "valueAt", i);
XposedHelpers.callMethod(param.thisObject, "removeConnectionLocked", ConnectionRecord, app, null);
}
XposedHelpers.callMethod(connections, "clear");
Object smap = XposedHelpers.callMethod(param.thisObject, "getServiceMap", XposedHelpers.getObjectField(app, "userId"));
// Now do remaining service cleanup.
services = XposedHelpers.getObjectField(app, "services");
size = (Integer) XposedHelpers.callMethod(services, "size");
for (int i = size - 1; i >= 0; i--) {
Object sr = XposedHelpers.callMethod(services, "valueAt", i);
Object mServicesByName = XposedHelpers.getObjectField(smap, "mServicesByName");
if (XposedHelpers.callMethod(mServicesByName, "get", XposedHelpers.getObjectField(sr, "name")) != sr) {
Object cur = XposedHelpers.callMethod(mServicesByName, "get", XposedHelpers.getObjectField(sr, "name"));
Slog.wtf(TAG, "Service " + sr + " in process " + app + " not same as in map: " + cur);
Object app_services = XposedHelpers.getObjectField(app, "services");
XposedHelpers.callMethod(app_services, "removeAt", i);
continue;
}
// Any services running in the application may need to be
// placed back in the pending list.
Object serviceInfo = XposedHelpers.getObjectField(sr, "serviceInfo");
Object applicationInfo = XposedHelpers.getObjectField(serviceInfo, "applicationInfo");
if (allowRestart && XposedHelpers.getIntField(sr, "crashCount") >= 2 && (XposedHelpers.getIntField(applicationInfo, "flags") & ApplicationInfo.FLAG_PERSISTENT) == 0) {
Slog.w(TAG, "Service crashed " + XposedHelpers.getIntField(sr, "crashCount") + " times, stopping: " + sr);
EventLog.writeEvent(EventLogTags.AM_SERVICE_CRASHED_TOO_MUCH, XposedHelpers.getObjectField(sr, "userId"), XposedHelpers.getObjectField(sr, "crashCount"), XposedHelpers.getObjectField(sr, "shortName"), XposedHelpers.getObjectField(app, "pid"));
XposedHelpers.callMethod(param.thisObject, "bringDownServiceLocked", sr);
} else if (!allowRestart) {
XposedHelpers.callMethod(param.thisObject, "bringDownServiceLocked", sr);
} else {
boolean canceled = (Boolean) XposedHelpers.callMethod(param.thisObject, "scheduleServiceRestartLocked", sr, true);
// Should the service remain running? Note that in the
// extreme case of so many attempts to deliver a command
// that it failed we also will stop it here.
if (XposedHelpers.getBooleanField(sr, "startRequested") && (XposedHelpers.getBooleanField(sr, "stopIfKilled") || canceled)) {
Object pendingStarts = XposedHelpers.getObjectField(sr, "pendingStarts");
if ((Integer) XposedHelpers.callMethod(pendingStarts, "size") == 0) {
XposedHelpers.setBooleanField(sr, "startRequested", false);
if (XposedHelpers.getObjectField(sr, "tracker") != null) {
Object tracker = XposedHelpers.getObjectField(sr, "tracker");
Object mAm = XposedHelpers.getObjectField(param.thisObject, "mAm");
Object mProcessStats = XposedHelpers.getObjectField(mAm, "mProcessStats");
XposedHelpers.callMethod(tracker, "setStarted", false, XposedHelpers.callMethod(mProcessStats, "getMemFactorLocked"), SystemClock.uptimeMillis());
}
if (!XposedHelpers.getBooleanField(sr, "hasAutoCreateConnections")) {
// Whoops, no reason to restart!
XposedHelpers.callMethod(param.thisObject, "bringDownServiceLocked", sr);
}
}
}
}
}
if (!allowRestart) {
Object app_services = XposedHelpers.getObjectField(app, "services");
XposedHelpers.callMethod(app_services, "clear");
// Make sure there are no more restarting services for this
// process.
Object mRestartingServices = XposedHelpers.getObjectField(param.thisObject, "mRestartingServices");
for (int i = (Integer) XposedHelpers.callMethod(mRestartingServices, "size") - 1; i >= 0; i--) {
Object r = XposedHelpers.callMethod(mRestartingServices, "get", i);
String processName = (String) XposedHelpers.getObjectField(r, "processName");
Object serviceInfo = XposedHelpers.getObjectField(r, "serviceInfo");
Object applicationInfo = XposedHelpers.getObjectField(serviceInfo, "applicationInfo");
Object info = XposedHelpers.getObjectField(app, "info");
if (processName.equals((String) XposedHelpers.getObjectField(app, "processName")) && XposedHelpers.getIntField(applicationInfo, "uid") == XposedHelpers.getIntField(info, "uid")) {
XposedHelpers.callMethod(mRestartingServices, "remove", i);
XposedHelpers.callMethod(param.thisObject, "clearRestartingIfNeededLocked", r);
}
}
Object mPendingServices = XposedHelpers.getObjectField(param.thisObject, "mPendingServices");
for (int i = (Integer) XposedHelpers.callMethod(mPendingServices, "size") - 1; i >= 0; i--) {
Object r = XposedHelpers.callMethod(mPendingServices, "get", i);
String processName = (String) XposedHelpers.getObjectField(r, "processName");
Object serviceInfo = XposedHelpers.getObjectField(r, "serviceInfo");
Object applicationInfo = XposedHelpers.getObjectField(serviceInfo, "applicationInfo");
Object info = XposedHelpers.getObjectField(app, "info");
if (processName.equals((String) XposedHelpers.getObjectField(app, "processName")) && XposedHelpers.getIntField(applicationInfo, "uid") == XposedHelpers.getIntField(info, "uid")) {
XposedHelpers.callMethod(mPendingServices, "remove", i);
}
}
}
// Make sure we have no more records on the stopping list.
Object mDestroyingServices = XposedHelpers.getObjectField(param.thisObject, "mDestroyingServices");
int i = (Integer) XposedHelpers.callMethod(mDestroyingServices, "size");
while (i > 0) {
i--;
Object sr = XposedHelpers.callMethod(mDestroyingServices, "get", i);
if (XposedHelpers.getObjectField(sr, "app") == app) {
XposedHelpers.callMethod(sr, "forceClearTracker");
XposedHelpers.callMethod(mDestroyingServices, "remove", i);
if (DEBUG_SERVICE)
Slog.v(TAG, "killServices remove destroying " + sr);
}
}
Object executingServices = XposedHelpers.getObjectField(app, "executingServices");
XposedHelpers.callMethod(executingServices, "clear");
return null;
}
});
}
}
Perfect. Good work.
Excellent! ^_^ We need more of your kind to fix goggles sloppy work...thanks!
chw9999 said:
Excellent! ^_^ We need more of your kind to fix goggles sloppy work...thanks!
Click to expand...
Click to collapse
just show and I will try )))
Awesome work!
Could you create a module for this fix also? https://android-review.googlesource.com/#/c/98918
a3Dman said:
Awesome work!
Could you create a module for this fix also? https://android-review.googlesource.com/#/c/98918
Click to expand...
Click to collapse
what if we will combine all bugs fixes in one mod?
Beautiful! I had this annoying issue with Skype.
Falseclock said:
what if we will combine all bugs fixes in one mod?
Click to expand...
Click to collapse
Fix working on my S5 Android 4.4.2
Thanks!
Sent from my SM-G900F using XDA Premium 4 mobile app
Hey there! Thank you! This module doesn't change the behaviour of the Google Play Music app when you swipe it from recents on my phone. I've installed it on my phone, and music still stops after clearing the app from recents.
Also, the last few comments on the Google Code issue tracker page say "This has been fixed in 4.4.3. Yay!" and "I just tested on 4.4.4, and can confirm that this appears to be fixed."...
But I'm running 4.4.4 on my Nexus 5, and Play Music still behaves that way. What gives? Any insight?
ZCochrane said:
But I'm running 4.4.4 on my Nexus 5, and Play Music still behaves that way. What gives? Any insight?
Click to expand...
Click to collapse
Affected version: 4.4, 4.4.1, and 4.4.2.
you do not need this mod.
Falseclock said:
Affected version: 4.4, 4.4.1, and 4.4.2.
you do not need this mod.
Click to expand...
Click to collapse
But that's what I'm saying, 4.4.4 is also affected, with Google Play Music behaving in the abnormal way you described.
ZCochrane said:
But that's what I'm saying, 4.4.4 is also affected, with Google Play Music behaving in the abnormal way you described.
Click to expand...
Click to collapse
yep, sorry. this is another issue
and related to 4.4.4
looking for solution
Falseclock said:
yep, sorry. this is another issue
and related to 4.4.4
looking for solution
Click to expand...
Click to collapse
Ooh, cool, gotcha!
Thanks!
ZCochrane said:
Ooh, cool, gotcha!
Thanks!
Click to expand...
Click to collapse
https://android-review.googlesource.com/#/c/53871/
will try to fix... too much coding (((
725 lines of code... looks almost impossible
a3Dman said:
Awesome work!
Could you create a module for this fix also? https://android-review.googlesource.com/#/c/98918
Click to expand...
Click to collapse
tonight :good:
Is HTC Sense 5.5 with Android 4.4.2 also affected?
[size=-2]Send with much love & Android. ( HTC One M7 )[/size]
n0j0e said:
Is HTC Sense 5.5 with Android 4.4.2 also affected?
Click to expand...
Click to collapse
yes
ZCochrane said:
Ooh, cool, gotcha!
Thanks!
Click to expand...
Click to collapse
on HTC 4.4.2 this bug already fixed so can't check by myself
please try with Google Music.
if you will get boot-loop - see OP
Falseclock said:
on HTC 4.4.2 this bug already fixed so can't check by myself
please try with Google Music.
if you will get boot-loop - see OP
Click to expand...
Click to collapse
That almost did it!! You're on the right track though, amazing!!
Now this happens:
1) Open Music & start song playback
2) Open recents, swipe Music away, then tap Home button.
3) Music keeps playing! (YAY!)
4) Open music app again, but do nothing in it. (Notification icon is removed, but the notification icon was never displayed when the app is open, so it's normal behaviour)
5) Tap Recent Tasks, music stops instantly, even without swiping the app away, notification icon stays gone.
6) (interestingly, at this stage, tapping the app's recent thumbnail doesn't open the app, nor does the Back button)
Problem is a step 5.
It's pretty cool to see this problem get attention, though.

Categories

Resources