[Q] Get primary phone number of android contact : Android Dev - Android Q&A, Help & Troubleshooting

I am trying to fetch the primary number of a contact in Android but not getting the desired result.
Using the following code
Code:
cursor = getActivity().getContentResolver().query(Phone.CONTENT_URI, null, Phone.CONTACT_ID + "=?", new String[] { id }, null);
phoneIdx = cursor.getColumnIndex(Phone.DATA);
if (cursor.moveToFirst()) {
while (cursor.isAfterLast() == false) {
String phoneNumber = cursor.getString(phoneIdx);
Log.d(TAG,"Number:::"+ phoneNumber);
int primary = cursor.getColumnIndex(Phone.IS_PRIMARY);
Log.d(TAG, "primary value:::"+ primary);
allNumbers.add(phoneNumber);
cursor.moveToNext();
}
}
I have a contact with 2 numbers. One of them is set to primary by holding the number for long and choosing "set as default". When I run this code on the said contact, the PHONE.IS_PRIMARY returns 45 for both the numbers.
I wish to know which of the number has been set to default for a contact.

Related

Signature Capture from web page

I am developing a PHP app that runs on an XDA2 PocketPC. It is for use by field engineers to book themselves to jobs whilst on-site, and it will update our internal stock system etc.
The need has arisen for signature capture, whereby a signature area is embedded into a web page and when the client signs the screen, it is transferred safely into a database at our offices.
I have looked at various possibilities but they all seem to rely on ASP/VBSCRIPT.
Has anyone ever come across something that will integrate with my PHP web app?
In a nutshell: Signature region in web page, user signs screen,signature data sent to a SQL database back at base.
Any ideas? :shock:
Hi limepickle
The webbrowser in WM2003 is really quite primitive in comparison to it's desktop counterparts these days. For that reason, i really do not think that you will find a way to do this in the browser.
I write software similar to that which you are talking about using .NET and i've considered using web pages once or twice for simpler apps, but signature capture was always the sticking point which I could never think of a way to acheive...
Sorry to disappoint you :roll:
Pope <><
limepickle said:
I am developing a PHP app that runs on an XDA2 PocketPC. It is for use by field engineers to book themselves to jobs whilst on-site, and it will update our internal stock system etc.
The need has arisen for signature capture, whereby a signature area is embedded into a web page and when the client signs the screen, it is transferred safely into a database at our offices.
I have looked at various possibilities but they all seem to rely on ASP/VBSCRIPT.
Has anyone ever come across something that will integrate with my PHP web app?
In a nutshell: Signature region in web page, user signs screen,signature data sent to a SQL database back at base.
Any ideas? :shock:
Click to expand...
Click to collapse
your gonna get stuck with a php version since the pocket IE isnt that great,
perhaps you can find a flash based signature capture and has flash on the pocket pcs?
this is our solution:
i created a custom application to do this for our company,
its developed using the OpenNet Compact Framework.
its a fullscreen signature app and when the rep is ready to upload the signature they click the send button that transfers it to a ASP.NET web service. this then saves the image as Jpeg to a shared folder and also to SQL for archiving,
check out:
http://www.opennetcf.org/CategoryView.aspx?category=Home
http://www.codeproject.com/netcf/Signature_Capture.asp
this is an example of the code to use in VS.NET with OpenNetCF.
Code:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.IO;
using System.Xml;
namespace WGTools
{
/// <summary>
/// Summary description for frmSignatureCapture.
/// </summary>
public class frmSignatureCapture : System.Windows.Forms.Form
{
private OpenNETCF.Windows.Forms.Signature signature1;
private System.Windows.Forms.Button button1;
private OpenNETCF.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.Button button3;
private Microsoft.WindowsCE.Forms.InputPanel inputPanel1;
private System.Windows.Forms.ToolBar toolBar1;
private OpenNETCF.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.Button button4;
private System.Windows.Forms.Button button5;
Guid guid = Rico.Tools.PocketGuid.NewGuid();
public frmSignatureCapture()
{
InitializeComponent();
}
protected override void Dispose( bool disposing )
{
base.Dispose( disposing );
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(frmSignatureCapture));
this.groupBox1 = new OpenNETCF.Windows.Forms.GroupBox();
this.button1 = new System.Windows.Forms.Button();
this.signature1 = new OpenNETCF.Windows.Forms.Signature();
this.groupBox2 = new OpenNETCF.Windows.Forms.GroupBox();
this.textBox1 = new System.Windows.Forms.TextBox();
this.button2 = new System.Windows.Forms.Button();
this.button3 = new System.Windows.Forms.Button();
this.inputPanel1 = new Microsoft.WindowsCE.Forms.InputPanel();
this.toolBar1 = new System.Windows.Forms.ToolBar();
this.button4 = new System.Windows.Forms.Button();
this.button5 = new System.Windows.Forms.Button();
//
// groupBox1
//
this.groupBox1.Controls.Add(this.button1);
this.groupBox1.Location = new System.Drawing.Point(8, 0);
this.groupBox1.Size = new System.Drawing.Size(224, 264);
this.groupBox1.Text = "New Signature";
//
// button1
//
this.button1.Location = new System.Drawing.Point(16, 120);
this.button1.Size = new System.Drawing.Size(192, 32);
this.button1.Text = "Create New Signature";
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// signature1
//
this.signature1.BackColor = System.Drawing.Color.DimGray;
this.signature1.BackgroundBitmap = ((System.Drawing.Bitmap)(resources.GetObject("signature1.BackgroundBitmap")));
this.signature1.BorderColor = System.Drawing.Color.Black;
this.signature1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.signature1.ForeColor = System.Drawing.Color.White;
this.signature1.Location = new System.Drawing.Point(240, 0);
this.signature1.Size = new System.Drawing.Size(240, 320);
this.signature1.Text = "SignatureControl";
//
// groupBox2
//
this.groupBox2.Controls.Add(this.button5);
this.groupBox2.Controls.Add(this.button4);
this.groupBox2.Controls.Add(this.textBox1);
this.groupBox2.Location = new System.Drawing.Point(488, 0);
this.groupBox2.Size = new System.Drawing.Size(224, 264);
this.groupBox2.Text = "Signature Details";
//
// textBox1
//
this.textBox1.AcceptsReturn = true;
this.textBox1.Location = new System.Drawing.Point(8, 24);
this.textBox1.Multiline = true;
this.textBox1.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
this.textBox1.Size = new System.Drawing.Size(208, 96);
this.textBox1.Text = "textBox1";
//
// button2
//
this.button2.Location = new System.Drawing.Point(240, 0);
this.button2.Size = new System.Drawing.Size(24, 20);
this.button2.Text = ">";
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// button3
//
this.button3.Location = new System.Drawing.Point(240, 248);
this.button3.Size = new System.Drawing.Size(24, 20);
this.button3.Text = "c";
//
// button4
//
this.button4.Location = new System.Drawing.Point(32, 176);
this.button4.Size = new System.Drawing.Size(160, 20);
this.button4.Text = "Upload To HeadOffice";
this.button4.Click += new System.EventHandler(this.button4_Click);
//
// button5
//
this.button5.Location = new System.Drawing.Point(32, 208);
this.button5.Size = new System.Drawing.Size(160, 20);
this.button5.Text = "Save To File";
this.button5.Click += new System.EventHandler(this.button5_Click);
//
// frmSignatureCapture
//
this.ClientSize = new System.Drawing.Size(1122, 265);
this.Controls.Add(this.button3);
this.Controls.Add(this.button2);
this.Controls.Add(this.groupBox2);
this.Controls.Add(this.signature1);
this.Controls.Add(this.groupBox1);
this.Controls.Add(this.toolBar1);
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Text = "New Signature";
this.Load += new System.EventHandler(this.frmSignatureCapture_Load);
}
#endregion
private void button1_Click(object sender, System.EventArgs e)
{
this.WindowState = FormWindowState.Maximized;
this.ControlBox = false;
this.Menu = null;
this.signature1.Location = new System.Drawing.Point(0, 0);
this.button2.Location = new System.Drawing.Point(0, 0);
this.button3.Location = new Point(0,298);
this.Controls.Remove(this.toolBar1);
}
private void button2_Click(object sender, System.EventArgs e)
{
this.WindowState = FormWindowState.Normal;
this.ControlBox = true;
this.groupBox2.Location = new System.Drawing.Point(8,0);
this.button2.Visible = false;
this.button3.Visible = false;
this.signature1.Visible = false;
this.Controls.Add(this.toolBar1);
this.textBox1.Text = Convert.ToBase64String(this.signature1.GetSignatureEx(),0,this.signature1.GetSignatureEx().Length);
}
private void frmSignatureCapture_Load(object sender, System.EventArgs e)
{
}
private void button4_Click(object sender, System.EventArgs e)
{
//TEST - send the sig to the WS
WSSig.ws1 wssig = new WGTools.WSSig.ws1();
try
{
textBox1.Text = wssig.CaptureSignature_V1("xxxxxx","username","sigID","notes",this.signature1.GetSignatureEx());
}
catch(Exception e3)
{
textBox1.Text = e3.ToString();
}
}
private void button5_Click(object sender, System.EventArgs e)
{
if(Rico.Tools.Stuff.SaveSigToFile("rico","theid","notes",Convert.ToBase64String(this.signature1.GetSignatureEx(),0,this.signature1.GetSignatureEx().Length)))
MessageBox.Show("Saved To File","Saved",MessageBoxButtons.OK,MessageBoxIcon.Asterisk,MessageBoxDefaultButton.Button1);
this.textBox1.Text = "saved to file";
}
}
}
Yes, I think you're right, Flash will probably be the way to go, seeing as everyone seems to to be .NET / ASP crazy!!!!
LOL
PS. thanks Pope and djrm, I do appreciate you trying to help, its just that anything to do with .net vb etc, may as well be Urdu.
asp.net web signature capture control
You can try out http://mysignature.brinkster.net for this
Don't Necro old threads for shamelesly plugging your software..

[Q] Filter Contacts by Group with ContactsContract

Hello!
I'm developing a big application and a part of it is about contacts. I want to, first, get all the groups of contacts. And when the users selects one, show all the contacts of the group.
I've seen other applications and widgets (like LauncherPro widget or HTC Sense Widget) than can do it, but when I try, I don't get same results.
My code is:
1.- To get an example group (this is just for testing, in real application user selects):
Code:
long idGroup = 0;
String[] GROUP_PROJECTION = new String[] {
ContactsContract.Groups._ID, ContactsContract.Groups.TITLE };
Cursor c = mcp.getContext().getContentResolver().query(ContactsContract.Groups.CONTENT_URI, GROUP_PROJECTION, null, null, ContactsContract.Groups.TITLE + " ASC");
while(c.moveToNext())
{
if (c.getString(1).contains("Family")){
idGroup = c.getLong(0);
}
}
c.close();
2.- To filter Users by group??
Thank you!
2.- To filter Users by group??
Same question... Cannot find the answer... Anybody knows ?
well maybe i should not revive this thread, but i had a lot of issues finding this,, my code working and you can filter and avoid repeated groups and only with phone numbers
Code:
String[] GROUP_PROJECTION = new String[] {
ContactsContract.Groups._ID, ContactsContract.Groups.TITLE,ContactsContract.Groups.SUMMARY_COUNT ,ContactsContract.Groups.SUMMARY_WITH_PHONES };
Cursor c = context.getApplicationContext().getContentResolver().query(
ContactsContract.Groups.CONTENT_SUMMARY_URI,
GROUP_PROJECTION,
ContactsContract.Groups.SUMMARY_WITH_PHONES +"> 0"
, null, ContactsContract.Groups.TITLE + " ASC");

[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] Cannot get a android sqlite select statement to work !

Hi guys,
I'm trying to select the items that have a expiration date >= that an selected date.
I'm using the format yyyy-mm-dd, and this is my sql statement:
String sql = "SELECT _id, item, value, finalDate FROM "+DATABASE_TABLE+" WHERE date(finalDate) >= date("+selectedDate+")";
This query always result a "full select" in my database, as if there were no conditions.
Some useful information:
selectDate is a String which have a date in yyyy-mm-dd format
I'm executing the query like this:
return db.rawQuery(sql,null);
I think it has to do with the quotes
Try:
String sql = "SELECT _id, item, value, finalDate FROM "+DATABASE_TABLE+" WHERE date(finalDate) >= date('" +selectedDate+ "')";
OR
String sql = "SELECT _id, item, value, finalDate FROM "+DATABASE_TABLE+" WHERE date('finalDate') >= date('" +selectedDate+ "')";
I am not 100% sure that will work but my code looks like this ( that works )
public Cursor fetchMedicineEventByDate(String date) {
return mDb.query(DATABASE_MEDICINEEVENT_TABLE,
new String[] { DATABASE_MEDICINEEVENT_ID,
DATABASE_MEDICINEEVENT_AMOUNT,
DATABASE_MEDICINEEVENT_MEDICINETYPEID,
DATABASE_MEDICINEEVENT_TIMESTAMP,
DATABASE_MEDICINEEVENT_USERID }, "date("
+ DATABASE_MEDICINEEVENT_TIMESTAMP + ") " + " = "
+ "date('" + date + "')", null, null, null, null);
}
This give me all items from the given date ( i use the query method but im sure it will work with rawquery to )
If it works please say so and press thanks
I was missing the quotes, like you said ! Thanks a lot !
gkenny1991 said:
I think it has to do with the quotes
Try:
String sql = "SELECT _id, item, value, finalDate FROM "+DATABASE_TABLE+" WHERE date(finalDate) >= date('" +selectedDate+ "')";
OR
String sql = "SELECT _id, item, value, finalDate FROM "+DATABASE_TABLE+" WHERE date('finalDate') >= date('" +selectedDate+ "')";
I am not 100% sure that will work but my code looks like this ( that works )
public Cursor fetchMedicineEventByDate(String date) {
return mDb.query(DATABASE_MEDICINEEVENT_TABLE,
new String[] { DATABASE_MEDICINEEVENT_ID,
DATABASE_MEDICINEEVENT_AMOUNT,
DATABASE_MEDICINEEVENT_MEDICINETYPEID,
DATABASE_MEDICINEEVENT_TIMESTAMP,
DATABASE_MEDICINEEVENT_USERID }, "date("
+ DATABASE_MEDICINEEVENT_TIMESTAMP + ") " + " = "
+ "date('" + date + "')", null, null, null, null);
}
This give me all items from the given date ( i use the query method but im sure it will work with rawquery to )
If it works please say so and press thanks
Click to expand...
Click to collapse
no problem this can be locked now

[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