There are some threads on this for other models, but I am looking for info on how to remove wireless charging notification for my Sprint version. I assume this will require root and I have no problem with that.
Here's the scenario. I modified my Sprint phone to accept the Verizon wireless charging rear cover, while preserving NFC. (Email me if you want the link cuz I don't have sufficient privileges to post it).
Placing the phone on the charger gives a pop-up notification and tone that wireless charging has begun. Then wireless charging is complete (100%) and charging stops. Then the phone sits on the charger for a few minutes, drops to 99% full and wireless charging begins again, meaning another beep. This is an endless cycle and the constant beeps are driving me crazy.
I have turned off all volumes, all notifications, placed on silent, etc., but the "Starting Wireless Charging" tone and notification is still present.
Really would like to get this fixed as inductive charging is awesome, but not if the phone is gonna beep every few minutes.
Does it bulge the battery cover slightly?
Just look for the mod to remove full charge notification, I believe all the different charging notis are housed in the same location. The VZW disable mod *should* also work as long as you do it manually and don't flash any zips with their updater script included.
I like to break stuff!
@freeza: I did a 10 minute mod to the Sprint phone using cooper conductive tape, so no soldering or opening the phone. Now it accepts the Verizon Wireless Charging back cover. So the cover is stock, its just Verizon, not Sprint. I can't post the link to my how-to (XDA rules), but just Google for "How to EASILY Add Inductive/Wireless Charging to your Sprint Phone Using Verizon Cover & Keeping NFC" and it is the first link.
@EViL-KoNCEPTz: I just successfully rooted today, never had the motivation before now but I absolutely have to get rid of this notification.
In researching this, I found the post quoted below -- by Freeza coincidentally. So now I just need to learn how to: (1) Get to the /com directory (that directory doesn't seem to be listed in my root explorer app); (2) learn how to compile; (3) learn how to push the compiled file to the phone and (4) learn how to change permissions. Of course, I'll also have to locate the "wireless charging begin" file, which is hopefully in the same location as you predict.
Lots to learn. Sucks being such a noob.
7/17/12: Remove battery full notification:
Navigate to /com/android/systemui/power/PowerUI$1.smali
LOOK FOR:
Code:
iget v14, v14, Lcom/android/systemui/power/PowerUI;->mBatteryStatus:I
if-ne v13, v14, :cond_1b3
move-object/from16 v0, p0
iget-object v13, v0, Lcom/android/systemui/power/PowerUI$1;->this$0:Lcom/android/systemui/power/PowerUI;
invoke-virtual {v13}, Lcom/android/systemui/power/PowerUI;->notifyFullBatteryNotification()V
:cond_da
:goto_da
const/4 v13, 0x4
REMOVE:
Code:
invoke-virtual {v13}, Lcom/android/systemui/power/PowerUI;->notifyFullBatteryNotification()V
Save & Close
Compile, push to /system/app/ and change permissions to 644 and reboot or create flashable zip to flash in recovery.
Click to expand...
Click to collapse
Actually, I'm not overly concerned with the pop-up message (""WIRELESS CHARGING: You have placed the device within range. Now charging wirelessly."). I really just need to suppress the corresponding alert tone.
With my new found root access, I looked around (system/media/audio/ui) and found many audio files, but not the one that is triggered when wireless charging begins. Should I be looking somewhere else or does this tone not use an ogg sound file?
SOLVED
I feel a little stupid, but will post this anyway in case someone else has the same problem. The beep was coming from the wireless charging pad, not the phone. Who knew? Opened up the pad, pulled the tiny speaker, put it back together and problem solved.
Note that you do have to delete charger_connection.ogg from /system/media/audio/ui to get rid of the phone sounds, or simply turn down the volume on notifications.
Many thanks to freeza who helped me back channel; he was the one who figured this out. He also created a mod to suppress the "wireless charging has begun" pop-up.
I had the same problem
I recently came across the XPosed framework and have developed a module for it that:
Prevents the screen from turning on when a charger is connected
Disables the wireless charging popup
Disables the beep when a charger is connected
Prevents the screen from turning on when the battery is full
I will post a module once I've got past the min 10 post limit on dev threads
In the meantime I hope this helps...
Code:
public class DisableWirelessChargingPopup implements IXposedHookLoadPackage
{
volatile PowerManager mPowerMgr;
volatile boolean mWakeUpEnabled = true;
[user=439709]@override[/user]
public void handleLoadPackage(LoadPackageParam lpparam) throws Throwable
{
if (lpparam.packageName.equals("android"))
{
XposedBridge.log("handleLoadPackage: " + lpparam.packageName);
try
{
Class localClass = XposedHelpers.findClass("com.android.server.PowerManagerService$BatteryReceiver", lpparam.classLoader);
Object[] parameterTypesAndCallbackPower = new Object[3];
parameterTypesAndCallbackPower[0] = Context.class;
parameterTypesAndCallbackPower[1] = Intent.class;
parameterTypesAndCallbackPower[2] = XC_MethodReplacement.DO_NOTHING;
XposedHelpers.findAndHookMethod(localClass, "onReceive", parameterTypesAndCallbackPower);
XposedBridge.log("Hooked: PowerManagerService$BatteryReceiver");
}
catch (Exception e)
{
XposedBridge.log(e.toString());
}
}
if (lpparam.packageName.equals("com.android.systemui"))
{
XposedBridge.log("handleLoadPackage: " + lpparam.packageName);
try
{
Object[] parameterTypesAndCallbackWireless = new Object[2];
parameterTypesAndCallbackWireless[0] = Integer.TYPE;
parameterTypesAndCallbackWireless[1] = XC_MethodReplacement.DO_NOTHING;
//XposedHelpers.findAndHookMethod("com.android.systemui.power.PowerUI", lpparam.classLoader, "showWirelessChargingNotice", arrayOfObject);
XposedHelpers.findAndHookMethod("com.android.systemui.power.PowerUI",
lpparam.classLoader, "showWirelessChargeDialog", parameterTypesAndCallbackWireless);
XposedBridge.log("Hooked: " + lpparam.packageName + " showWirelessChargeDialog");
}
catch (Exception e)
{
XposedBridge.log(e.toString());
}
try
{
Object[] parameterTypesAndCallbackPlaySound = new Object[2];
parameterTypesAndCallbackPlaySound[0] = Integer.TYPE;
parameterTypesAndCallbackPlaySound[1] = XC_MethodReplacement.DO_NOTHING;
XposedHelpers.findAndHookMethod("com.android.systemui.power.PowerUI",
lpparam.classLoader, "playSound", parameterTypesAndCallbackPlaySound);
XposedBridge.log("Hooked: " + lpparam.packageName + " playSound");
}
catch (Exception e)
{
XposedBridge.log(e.toString());
}
try
{
XposedHelpers.findAndHookMethod("com.android.systemui.power.PowerUI",
lpparam.classLoader, "notifyFullBatteryNotification",
XC_MethodReplacement.DO_NOTHING);
}
catch (Exception e)
{
XposedBridge.log(e.toString());
}
}
}
}
Related
Hi all guys
i am new to C# and .net stuff as i was working with C++ for many years
i want to know that is it possibhle that i can have an MDI Child Form on my main Form and want it to return me some data
like for example i have my main Form has a "settings" button
when i click on "settings" button it should show a small MDI child form which has all the settings and return some data (i'll take care of data but i dont know how to return through a form)
thnx in advance
Well...as far as 'returning' data from the Form, you can't do that as a "return" call because Forms are objects, so the constructor cannot have a return type, however you can have a method that will set a variable in another class (that is public) to the data you want to return ... You can call this method when the form is closing.
I am not entirely sure if you can achieve the 'small form INSIDE another form' without creating your own control. I am not sure how practical/possible this would be, but you can try 1 of the following: extend the Control class (to make a control) or override the OnPaint of a new Form. This way you can define where stuff goes, and what gets drawn onto the screen.
I have used this piece of code in the past, which worked great.
in my example frmA was an MDIchildform of the main (MDIparent)
frmA()
{
public int a=0;
private btn_click(blabla)
{
frmOptions options = new frmOptions(this);
dialog.ShowDialog();
if(dialog.DialogResult == DialogResult.Yes)
{
dosomethingwith(a);
}
else
{
donothingwith(a);
}
}
}
public partial class frmOptions : Form
{
frmA callingform = null;
public frmOptions(frmA x)
{
callingform = x;
}
private void dosomething()
{
callingform.a = value;
}
private void btnSaveSettings_click()
{
this.DialogResult = DialogResult.Yes;
}
private void btnCancelSettings_click()
{
this.DialogResult = DialogResult.No;
}
}
good luck
Hi,
I noticed that whenever I needed to use another part of my mobile phone (HTC HD2) and my application lost focus it would disappear. Looking at Task Manager the application was not there but often the process was still running. Click the application icon in the folder would cause the application to start up from scatch instead of just opening the instance created earlier.
I thought I had a fix that admittedly I Googled.
Code:
[DllImport("coredll.dll")]
static extern int ShowWindow(IntPtr hWnd, int nCmdShow);
const int SW_MINIMIZED = 6;
private void frmMain_Deactivate(object sender, EventArgs e)
{
HideApp();
}
private void HideApp()
{
ShowWindow(this.Handle, SW_MINIMIZED);
}
This seems to have made some difference. The application seems to disappear less than before; but the application is still disappearing as a process if it loses focus on occasions.
Can anyone please help?
Thanks, Dave.
So I'll admit this is the most hands on I've attempted to be with android yet, but I was wondering if anyone could either a) tell me how to toggle bluetooth on/off programmaticaly or point me to where I can find the source code for the Power Control widget and I'll just sort it out from there.
I know this is probably terribly simple I'm just finding it a bit overwhelming to get my bearings in the source code. heh.
alcaron said:
So I'll admit this is the most hands on I've attempted to be with android yet, but I was wondering if anyone could either a) tell me how to toggle bluetooth on/off programmaticaly or point me to where I can find the source code for the Power Control widget and I'll just sort it out from there.
I know this is probably terribly simple I'm just finding it a bit overwhelming to get my bearings in the source code. heh.
Click to expand...
Click to collapse
I would just use SwitchPro
SwitchPro Video Demo
Wow that is really cool! Although it doesn't help my situation.
I am actually more interested in extending the HTC default lockscreen to add a second slider (or possibly just a button) for enabling/disabling bluetooth.
Bluetooth is SUCH a power hog but I love handsfree in my car so short of finding some way to do a crazy RFID hack to enable it automatically when I get into my car (seriously, RFID is so great but aside from tagging merch nobody uses it for anything cool, if the evo had built in RFID capabilities, oh man, LOVE) I figure I'll just live with manually enabling it, however going through the unlock etc. is a bit cumbersome.
Failing all this I plan to just set it up to enable BT when plugged in/charging. So if what I want to do can't be done, I'll just set about making a useful/functional dock that doesn't require a bunch of jerking around (fiddling with a micro USB everytime I get in the car is for the birds).
alcaron said:
Wow that is really cool! Although it doesn't help my situation.
I am actually more interested in extending the HTC default lockscreen to add a second slider (or possibly just a button) for enabling/disabling bluetooth.
Bluetooth is SUCH a power hog but I love handsfree in my car so short of finding some way to do a crazy RFID hack to enable it automatically when I get into my car (seriously, RFID is so great but aside from tagging merch nobody uses it for anything cool, if the evo had built in RFID capabilities, oh man, LOVE) I figure I'll just live with manually enabling it, however going through the unlock etc. is a bit cumbersome.
Click to expand...
Click to collapse
Ohhhhhhh I see what you're wanting Have you tried flashing CyanogenMod 6? I get INSANE battery life(like 4x what I get on a stock ROM) so having BT on all the time wouldnt really be a problem.
There are already programs for car docks in the market place that enable Bluetooth when power is connected and turns it off when disconnected.
I'm hoping to avoid needing to dock it as I currently just leave my phone in my pocket when I get in the car. So having the ability to hit power and touch/slide to enable BT would be great. I just need to figure out how to activate it programattically.
If I go the route of docking it yeah I'll probably just use Locale or something.
djR3Z said:
Ohhhhhhh I see what you're wanting Have you tried flashing CyanogenMod 6? I get INSANE battery life(like 4x what I get on a stock ROM) so having BT on all the time wouldnt really be a problem.
Click to expand...
Click to collapse
off topic:
how do you get that much battery life??!?!?! mine seems to drain pretty quickly
on topic:
i'm pretty sure you can program bluetooth to toggle on and off automatically with the app juice defender. i'm not sure though.
alcaron said:
So I'll admit this is the most hands on I've attempted to be with android yet, but I was wondering if anyone could either a) tell me how to toggle bluetooth on/off programmaticaly or point me to where I can find the source code for the Power Control widget and I'll just sort it out from there.
I know this is probably terribly simple I'm just finding it a bit overwhelming to get my bearings in the source code. heh.
Click to expand...
Click to collapse
Eclair - Release (2.1 update 1) Power Control widget source code.
http://android.git.kernel.org/?p=pl...0733fc357c35e316383ad3c11f0;hb=eclair-release
Toggling programatically :
Code:
import com.android.settings.bluetooth.LocalBluetoothManager;
private static LocalBluetoothManager mLocalBluetoothManager = null;
private static final int STATE_DISABLED = 0;
private static final int STATE_ENABLED = 1;
private static final int STATE_INTERMEDIATE = 2;
private static int getBluetoothState(Context context) {
if (mLocalBluetoothManager == null) {
mLocalBluetoothManager = LocalBluetoothManager.getInstance(context);
if (mLocalBluetoothManager == null) {
return STATE_INTERMEDIATE;
}
}
int state = mLocalBluetoothManager.getBluetoothState();
if (state == BluetoothAdapter.STATE_OFF) {
return STATE_DISABLED;
} else if (state == BluetoothAdapter.STATE_ON) {
return STATE_ENABLED;
} else {
return STATE_INTERMEDIATE;
}
}
private void toggleBluetooth(Context context) {
int state = getBluetoothState(context);
if (state == STATE_ENABLED) {
mLocalBluetoothManager.setBluetoothEnabled(false);
} else if (state == STATE_DISABLED) {
mLocalBluetoothManager.setBluetoothEnabled(true);
}
Toast.makeText(context, R.string.gadget_toggle_bluetooth, Toast.LENGTH_SHORT).show();
}
Good luck, have fun.
Hello dear forum members,
As far as I know , moto360 doesn't have a sensor of type : TYPE_HEART_RATE, it's called passive wellness sensor.
The problem is that this wellness sensor is not giving me any data, as opposed to every other sensor that I've tried (like gravity, accelerometer...)
I've been waiting for more than 5 min but this sensor gives me data only when I start the app.
I've tried sdk20,sdk21,sdk22,sdk23 ... still no result I also have the android.permission.BODY_SENSORS in my manifest
Question : How to get the sensor working, what can I do?
Code:
package com.x.firstapp;
import android.app.Activity;
import android.os.Bundle;
import android.support.wearable.view.WatchViewStub;
import android.util.Log;
import android.widget.Toast;
import android.hardware.Sensor;
import android.hardware.SensorEvent;
import android.hardware.SensorEventListener;
import android.hardware.SensorManager;
import android.view.WindowManager;
public class MainActivity extends Activity implements SensorEventListener {
private SensorManager mSensorManager;
private Sensor mHeartSensor;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
final WatchViewStub stub = (WatchViewStub) findViewById(R.id.watch_view_stub);
stub.setOnLayoutInflatedListener(new WatchViewStub.OnLayoutInflatedListener() {
@Override
public void onLayoutInflated(WatchViewStub stub) {
}
});
// keep watch screen on
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
Toast.makeText(getApplicationContext(), "Hi Oleg", Toast.LENGTH_LONG).show();
mSensorManager = (SensorManager) getSystemService(SENSOR_SERVICE);
mHeartSensor = mSensorManager.getDefaultSensor(65538); //wellness sensor
mSensorManager.registerListener(this, mHeartSensor, SensorManager.SENSOR_DELAY_NORMAL);
}
public void onSensorChanged(SensorEvent event) {
if (event.sensor.getType() == 65538) {
String msg = "" + (int) event.values[0];
Log.d("Main Activity", msg);
}
}
@Override
public void onAccuracyChanged(Sensor sensor, int accuracy) {
Log.d("Main Activity", "accuracy : " + accuracy + " sensor : " + sensor.getName());
}
@Override
protected void onStop() {
super.onStop();
mSensorManager.unregisterListener(this);
}
only output out of this "wellness" sensor (only when app starts) :
D/Main Activity: accuracy : 3 sensor : Wellness Passive Sensor
D/Main Activity: 0
I have also posted this question on stack overflow, but so far - no success.
As soon as I get an answer here I'll spread it on stack overflow as well.
Thank you
Did you ever solve this? This might help.
What version of OS is your device running. For me, on my moto360 gen 1, now running 6.0.1, I have the permission in the manifest, but I MUST request it from the user using the new android M request mechanism, as BODY_SENSORS is labelled as a dangerous permission. Under debug, you can see all the sensors in the list if you get all sensors, but the iteration through them checks granted permissions.
Apparently, if the app is installed as a companion to an on phone app, it inherits the permissions from the device, so you don't need to ask, but a side-loaded app needs to ask.
Having said that, I clearly got a null for the HEART_RATE sensor until I'd requested user permissions. You at least get something.
dazbys said:
Did you ever solve this? This might help.
What version of OS is your device running. For me, on my moto360 gen 1, now running 6.0.1, I have the permission in the manifest, but I MUST request it from the user using the new android M request mechanism, as BODY_SENSORS is labelled as a dangerous permission. Under debug, you can see all the sensors in the list if you get all sensors, but the iteration through them checks granted permissions.
Apparently, if the app is installed as a companion to an on phone app, it inherits the permissions from the device, so you don't need to ask, but a side-loaded app needs to ask.
Having said that, I clearly got a null for the HEART_RATE sensor until I'd requested user permissions. You at least get something.
Click to expand...
Click to collapse
Hello,
It's a year later. I have a 2nd gen Moto 360 Sport. The android version is 6.01.
I am having what sounds like the same problem. Did you ever solve this?
I am using software which I basically copied from the web. When I run the software I get onAccuracyChanged events with accuracy values somewhere between one and three – mostly two and three.
But, I never get onSensorChanged events. I have the BODY_SENSORS permission in the manifest. And on the watch, if I go into Settings-Permissions, I see that the Sensors permission is enabled.
You mention "I MUST request it from the user using the new android M request mechanism". I'm not familiar with this mechanism. Could you explain a little more? I will also search for more information about this.
Do you have any more suggestions? Did you ever get yours working? It seems strange that I get the onAccuracyChanged events, but no onSensorChanged events. Could it possibly be something like the accuracy has to be four or greater in order to get onSensorChanged events?
Thanks,
Barry.
To answer my own question…
Of course it turned out I had a software error - I had assumed one of the event fields was an integer, it was not.
As was stated in the original answer: Be sure to have the BODY_SENSORS permission in the manifest (for both the phone and wearable). Since I am using SDK platform 20 rather than 23, I don't need to follow the android M procedure of requesting permission, but on the watch I did make sure the Settings-Permissions for my app had Sensors enabled.
Hi,
First, a disclaimer.
I am a Java and xposed noob. My background is in embedded C development so I can get by with some simple Java code and thanks to the great tutorials online I have been able to put together an xposed module but I'm struggling with a problem that is beyond my abilities now and am reaching out to the community for help.
Next, the background.
I have an Android head unit in my car. There is an app that provides me with CarPlay functionality but none of the controls on the steering wheel work with the app. When I analysed the code I found that they handle all of their button inputs using proprietary methods that do not inject an event into any input streams. I wrote an xposed module to hook the button press methods and then inject a proper input into one of the event streams.
Initially I tried to use the command line 'input' command to do this but since it is a Java app and takes about 1s to load it was too slow. My only other option was to create a virtual device on an input stream that I could then use to inject keypresses through the hooked method. To create a virtual device I needed to write C code that my xposed module would be able to access through the JNI. Long story short, after some pain I was able to get the native library integrated into the project and compiling using the NDK.
Finally, the problem.
When I was using the module without the native library it worked but just with a large delay because of the time it takes to load the 'input' java app. I was able to see logs from the module in the logcat as I hooked the method and as I went through the various actions within the hook.
As soon as I introduce the native library though the entire xposed module just stops running completely. I do not get any logs from the module even though I have installed, activated and rebooted. It shows up in the xposed installer but it just does nothing. The funny thing is that this happens even if I make no reference whatsoever to any native functions within the library. All I need to do to kill the module is to build it with the System.loadlibrary line in the Main.java uncommented. As soon as I comment that piece of code out the module starts to hook the function and output logs again. Below is the code from the Main.Java that I am referring to. I am happy to make any manifest, C and gradle files available too. Looking for any ideas as to why the module dies completely as soon as I include this...
Code:
package projects.labs.spike.zlink_xposed_swc;
import de.robv.android.xposed.XposedBridge;
import static de.robv.android.xposed.XposedHelpers.findAndHookMethod;
import de.robv.android.xposed.IXposedHookLoadPackage;
import de.robv.android.xposed.IXposedHookZygoteInit;
import de.robv.android.xposed.XSharedPreferences;
import de.robv.android.xposed.XC_MethodHook;
import de.robv.android.xposed.callbacks.XC_LoadPackage;
import de.robv.android.xposed.XposedHelpers;
import android.app.AndroidAppHelper;
import android.content.Intent;
import android.os.Bundle;
import android.content.Context;
/* shellExec and rootExec methods */
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.ByteArrayOutputStream;
import android.view.KeyEvent;
import android.media.AudioManager;
public class Main implements IXposedHookLoadPackage {
public static final String TAG = "ZLINK_XPOSED ";
public static void log(String message) {
XposedBridge.log("[" + TAG + "] " + message);
}
//public native int CreateVirtualDevice();
//public native int SendPrev();
@Override
public void handleLoadPackage(final XC_LoadPackage.LoadPackageParam lpparam) throws Throwable {
log("handleLoadPackage: Loaded app: " + lpparam.packageName);
if (lpparam.packageName.equals("com.syu.ms")) {
findAndHookMethod("module.main.HandlerMain", lpparam.classLoader, "mcuKeyRollLeft", new XC_MethodHook() {
@Override
protected void afterHookedMethod(XC_MethodHook.MethodHookParam param) throws Throwable {
// previous
log("PREVKEYHIT");
//rootExec("input keyevent 88");
log("EVENTSENT");
//Below was trying to use media keys which zlink never responded to...
/* Context context = (Context) AndroidAppHelper.currentApplication();
AudioManager mAudioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
KeyEvent event = new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_MEDIA_PREVIOUS);
mAudioManager.dispatchMediaKeyEvent(event);
KeyEvent event2 = new KeyEvent(KeyEvent.ACTION_UP, KeyEvent.KEYCODE_MEDIA_PREVIOUS);
mAudioManager.dispatchMediaKeyEvent(event2);*/
//Below is the failed broadcast intent method...
/*Context mcontext = (Context) AndroidAppHelper.currentApplication();
Intent i = new Intent("com.android.music.musicservicecommand");
i.putExtra("command", "pause");
mcontext.sendBroadcast(i);*/
}
});
}
}
public static String rootExec(String... strings) {
String res = "";
DataOutputStream outputStream = null;
InputStream response = null;
try {
Process su = Runtime.getRuntime().exec("su");
outputStream = new DataOutputStream(su.getOutputStream());
response = su.getInputStream();
for (String s : strings) {
s = s.trim();
outputStream.writeBytes(s + "\n");
outputStream.flush();
}
outputStream.writeBytes("exit\n");
outputStream.flush();
try {
su.waitFor();
} catch (InterruptedException e) {
e.printStackTrace();
}
res = readFully(response);
} catch (IOException e) {
e.printStackTrace();
} finally {
Closer.closeSilently(outputStream, response);
}
return res;
}
public static String readFully(InputStream is) throws IOException {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
byte[] buffer = new byte[1024];
int length = 0;
while ((length = is.read(buffer)) != -1) {
baos.write(buffer, 0, length);
}
return baos.toString("UTF-8");
}
static {
System.loadLibrary("native-lib");
}
}
Have you tried capturing an ADB log _during the bootup_?
Xposed bugs in general are unfortunaley hard to identify and harder to fix, since the underlying code isn't well understood and/or maintained by many people.
Namnodorel said:
Have you tried capturing an ADB log _during the bootup_?
Xposed bugs in general are unfortunaley hard to identify and harder to fix, since the underlying code isn't well understood and/or maintained by many people.
Click to expand...
Click to collapse
Thanks for the response. I think that I have it figured out. The System.loadlibrary method looks for the native library within a path relative to the process that it is running within. The code within the apk ultimately does not run within that apk process, it runs within the xposed process. You therefore need to give xposed an absolute path to the library using the system.load method instead. Going to do some fiddling tonight and see if it works.
looxonline said:
Thanks for the response. I think that I have it figured out. The System.loadlibrary method looks for the native library within a path relative to the process that it is running within. The code within the apk ultimately does not run within that apk process, it runs within the xposed process. You therefore need to give xposed an absolute path to the library using the system.load method instead. Going to do some fiddling tonight and see if it works.
Click to expand...
Click to collapse
What about an alternative without using library we discussed earlier? Are you planning to test this as well?
If so, please let me know how it went.
C3C076 said:
What about an alternative without using library we discussed earlier? Are you planning to test this as well?
If so, please let me know how it went.
Click to expand...
Click to collapse
I didn't try it yet for two reasons.
1.) From the research I have done it seems as if my app would need the system INJECT_EVENTS permission in order to send keypress events outside of its own process. I cannot get this permission unless I sign my apk with the system cert that the ROM is compiled with. Maybe the method that you are using in the suggestion does not need this cert? Have you personally used this to inject key events across processes? I did see that you are getting the context of the system input service so maybe that solves this issue if the request appears to come from that PID...???
2.) The unit that I am working with has only two input devices and none of them have the keycodes I require. Does your method use a completely virtual device that is created on the fly? If so then it could work well without the need for me to create an HID input device.
I mostly was just on a role with the method that I was trying and I didn't want to turn back since I was so far down the road. I'm sure you understand how addictive certain challenges become and its quite fun to try to get them working even if they may not be the most optimal way.
In any case I managed to get the native library working last night and can successfully convince Android that I have a real HID keyboard plugged in and then send key events through that keyboard. Still not done though as there are a few hiccups that need solving. May still try your original suggestion. Thanks
looxonline said:
I didn't try it yet for two reasons.
1.) From the research I have done it seems as if my app would need the system INJECT_EVENTS permission in order to send keypress events outside of its own process. I cannot get this permission unless I sign my apk with the system cert that the ROM is compiled with. Maybe the method that you are using in the suggestion does not need this cert? Have you personally used this to inject key events across processes? I did see that you are getting the context of the system input service so maybe that solves this issue if the request appears to come from that PID...???
2.) The unit that I am working with has only two input devices and none of them have the keycodes I require. Does your method use a completely virtual device that is created on the fly? If so then it could work well without the need for me to create an HID input device.
I mostly was just on a role with the method that I was trying and I didn't want to turn back since I was so far down the road. I'm sure you understand how addictive certain challenges become and its quite fun to try to get them working even if they may not be the most optimal way.
In any case I managed to get the native library working last night and can successfully convince Android that I have a real HID keyboard plugged in and then send key events through that keyboard. Still not done though as there are a few hiccups that need solving. May still try your original suggestion. Thanks
Click to expand...
Click to collapse
I see.
1) Depends on in what process (package) your hooks are running within because permissions of this process apply of course, not the permissions you define in your module's manifest.
I am using key injecting method within "android" process (package) which means it works without me needing to worry about INJECT_EVENTS permission as "android" process already has it.
By the way, missing permissions are not of a big issue when developing with xposed as you can really do some magic with it.
E.g. I was adding some functionality to SystemUI that required some additional permissions that SystemUI typically lacks. So my module takes care of it.
https://github.com/GravityBox/Gravi...eco/pie/gravitybox/PermissionGranter.java#L75
C3C076 said:
I see.
1) Depends on in what process (package) your hooks are running within because permissions of this process apply of course, not the permissions you define in your module's manifest.
I am using key injecting method within "android" process (package) which means it works without me needing to worry about INJECT_EVENTS permission as "android" process already has it.
By the way, missing permissions are not of a big issue when developing with xposed as you can really do some magic with it.
E.g. I was adding some functionality to SystemUI that required some additional permissions that SystemUI typically lacks. So my module takes care of it.
https://github.com/GravityBox/Gravi...eco/pie/gravitybox/PermissionGranter.java#L75
Click to expand...
Click to collapse
Wow! I had no idea that you can use an xposed helper function to grant permissions to whatever process you are hooked within like that. That is VERY cool. Thanks so much for sharing