Get TextView from method [RESOLVED] - Xposed Framework Development

I'm trying to get the TextView of the following method, but everything I have tried returns a null value.
This is the code:
Code:
public final void a(boolean z) {
if (z) {
if (this.W == null) {
this.W = new TextView(getContext());
this.W.setBackgroundResource(android.support.design.widget.b.AnonymousClass7.ay);
this.W.setGravity(17);
LayoutParams marginLayoutParams = new MarginLayoutParams(-2, -2);
marginLayoutParams.bottomMargin = getContext().getResources().getDimensionPixelSize(android.support.design.widget.b.AnonymousClass5.ap);
addView(this.W, marginLayoutParams);
this.h = this.W;
}
this.W.setText(k.e(getContext(), this.a.k).toUpperCase());
this.W.setTextSize(a(getResources()));
this.W.setVisibility(0);
this.t = true;
return;
}
if (this.W != null) {
this.W.setVisibility(8);
}
this.t = false;
}
This is one of the ways in which I have tried to obtain value.
Code:
findAndHookMethod(class, "a", boolean.class, new XC_MethodHook() {
@Override
protected void afterHookedMethod(XC_MethodHook.MethodHookParam params) throws Throwable {
super.afterHookedMethod(params);
TextView textView = (TextView) params.thisObject;
if (textView!=null) {
textView.setTextColor(color);
}
}
});
I have also tried the following:
Code:
TextView textView = (TextView) XposedHelpers.getObjectField(p.thisObject, "W");
and
Code:
TextView textView = (TextView] params.args[0];
But nothing is working.
Is it possible to get the TextView? and if it's possible, how to do it?

Problem solved, I had to assign the private variable field as setAccessible(true).

Related

[Q] [.net cf]Loopback

Hey guys
I'm developing a little webserver for WM with the .net cf. it's easy and works fine as long as I don't try to access it from the same device it's running on. Nothing works: localhost,127.0.0.1 or even if I'm connected to a wifi network and I use this IP. Has anyone the solution for this issue?
ta you
a yeah I use the TcpListener-Class and I implemted some simple HTTP.
chabun
Code
Hey guys
Noone has an idea??
Here is the code which I use to setup the HttpListener and answer connections.
Code:
using System;
using System.Linq;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Net;
using System.Net.Sockets;
using StedySoft.SenseSDK;
using System.Threading;
using System.IO;
namespace WebServer
{
public partial class ServerForm : Form
{
IPEndPoint local;
TcpListener listener;
private volatile bool stop;
private volatile bool handled;
SensePanelItem state;
SensePanelTextboxItem response;
Thread serverThread;
public ServerForm(IPEndPoint local)
{
InitializeComponent();
this.local = local;
SetupList();
}
private void SetupList()
{
SensePanelDividerItem infos = new SensePanelDividerItem("infd", "Infos");
mainList.AddItem(infos);
mainList.AddItem(new SensePanelItem("Local-Endpoint") { PrimaryText = "Local-Endpoint", SecondaryText = local.ToString() });
mainList.AddItem(state = new SensePanelItem("Status") { PrimaryText = "Status", SecondaryText = "Wird gestartet..." });
mainList.AddItem(new SensePanelDividerItem("Response", "Response"));
mainList.AddItem(response = new SensePanelTextboxItem("body") { LabelText = "HTML-Body, welcher auf Requests gesendet wird.", Text = "<span style =\"color:red;font-size:30pt\">It works!!</span>" });
mainList.AddItem(new SensePanelDividerItem("Requests", "Requests"));
}
private void StartServer()
{
if (listener != null)
{
StopServer(true);
}
listener = new TcpListener(local.Port);
listener.Start();
serverThread = new Thread(listen);
serverThread.IsBackground = true;
stop = false;
serverThread.Start();
state.SecondaryText = "Gestartet...";
}
private void listen()
{
while (!stop)
{
while (listener.Pending())
{
handled = false;
Thread handlingThread = new Thread(handler);
handlingThread.Start();
while (!handled)
Thread.Sleep(50);
}
Thread.Sleep(200);
}
}
private void handler()
{
// Get the current connection
TcpClient client = (TcpClient)this.Invoke(new Func<TcpClient>(listener.AcceptTcpClient));
IPEndPoint remote = (IPEndPoint)client.Client.RemoteEndPoint;
handled = true;
NetworkStream stream = client.GetStream();
StreamReader reader = new StreamReader(stream);
ReadHttpRequest(reader);
StreamWriter writer = new StreamWriter(stream);
StringBuilder response = new StringBuilder(); ;
StartHTML(response);
response.AppendLine((string)this.Invoke(new Func<IPEndPoint, string>(GetResponse), remote));
EndHTML(response);
WriteHTTPResponse(writer, response.Length);
writer.WriteLine(response.ToString());
writer.Flush();
stream.Close();
client.Close();
}
private void WriteHTTPResponse(StreamWriter writer, int length)
{
writer.WriteLine("HTTP/1.1 200 OK");
writer.WriteLine("Date: " + DateTime.Now.ToString());
writer.WriteLine("Content-Length: "+ length.ToString());
writer.WriteLine("Connection: close");
writer.WriteLine("Content-Type: text/html; charset=utf-8");
writer.WriteLine();
}
private void ReadHttpRequest(StreamReader reader)
{
string buffer = null;
while (buffer != "")
buffer = reader.ReadLine();
}
int counter = 0;
private string GetResponse(IPEndPoint remote)
{
counter++;
mainList.AddItem(new SensePanelItem(counter.ToString()) { PrimaryText = remote.ToString(), SecondaryText = "Response:" + counter.ToString() });
return response.Text;
}
private void EndHTML(StringBuilder writer)
{
writer.AppendLine("</body>");
writer.AppendLine("</html>");
}
private void StartHTML(StringBuilder writer)
{
writer.AppendLine("<?xml version=\"1.0\"?>");
writer.AppendLine("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">");
writer.AppendLine("<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"de\" lang=\"de\">");
writer.AppendLine("<head>");
writer.AppendLine("<title>SmartWebServer</title>");
writer.AppendLine("<meta name=\"author\" content=\"Alexander Kayed\">");
writer.AppendLine("</head>");
writer.AppendLine("<body>");
}
private void StopServer(bool restart)
{
stop = true;
serverThread.Join();
if (restart)
StartServer();
}
private void ServerForm_Load(object sender, EventArgs e)
{
StartServer();
}
private void ServerForm_Closed(object sender, EventArgs e)
{
StopServer(false);
}
private void menuItem1_Click(object sender, EventArgs e)
{
this.Close();
}
}
}
The user can choose the IPEndPoint(constructor), which the server will be bound to, in a prevouis form:
Code:
foreach (IPAddress ip in Dns.GetHostEntry(Dns.GetHostName()).AddressList)
{
item = new SensePanelRadioItem(ip.ToString());
item.PrimaryText = ip.ToString();
item.SecondaryText = ip.AddressFamily.ToString();
item.Tag = ChoosedIp = ip;
item.OnStatusChanged += new SensePanelRadioItem.StatusEventHandler(item_OnStatusChanged);
IPList.AddItem(item);
}
So the user can choose between IPs I got from the DNS (e.g. 127.0.0.1, 192.168.0.1) and type a free (valid) port number (eg. 80, 8080, 8888)
Thanks for Your help!!
Still no answer...
I will post my experiences with this issue as long as I solved it - like small blog. Maybe some of you have the same problem...
I found another strange thing:
I'm able to connect to my Server from a TcpClient from another self-written App (own exectuable, different AppDomain):
Code:
void test()
{
Action<string> setText = new Action<string>(setTestText);
try
{
this.Invoke(setText, "Connect...");
TcpClient client = new TcpClient();
client.Connect(local);
this.Invoke(setText, "Connected...");
NetworkStream stream = client.GetStream();
StreamWriter writer = new StreamWriter(stream);
StreamReader reader = new StreamReader(stream);
writer.WriteLine();
writer.Flush();
this.Invoke(setText, "Read answer");
string buffer = reader.ReadToEnd();
this.Invoke(setText, "Test succeeded");
testing = false;
}
catch
{
this.Invoke(setText, "Test failed");
}
}
And I got a the right answer as well. It's strange, really strange that the browsers (IE,Opera etc.) can't loopback to it?

TV OUT port for our ROMS - FIND SOLUTION and GET YOUR DONATE

Hi,
I bought MHL cable and RCA cable for connect my phone to TV ( play games on big screen and internet etc) . Today my RCA cable arrived MHL still on the way.
For few peoples who dont know diffrence between two cables. RCA connects on 3.5mm , MHL on mini-usb and MHL have hardware for TV out but rca doesnt.
I tried RCA but didnt work cus there is no TV-OUT option in our roms.
So is there anyway port TV-OUT option (app etc) from other roms?
I will try MHL too when it arrives.
EDIT: If you find a solution for TVOUT you can get DONATE from me [/SIZE]
I had the same question.
Sent from my HTC_A510c using XDA App
junxracr said:
I had the same question.
Sent from my HTC_A510c using XDA App
Click to expand...
Click to collapse
I Think is not posible because the jack of the wildfire dont have video signal, so even if you had the software you cannot
maybe the mhl one will work. tell us the result when you receive it
mud_f1 said:
I Think is not posible because the jack of the wildfire dont have video signal, so even if you had the software you cannot
Click to expand...
Click to collapse
We've already got a whole thread about peoples opinions on this matter. Please guys, only weigh in if you have REAL experience as this is something we all want to know for sure.
Oh sorry i didnt know that.
I will try mhl too when i get it but still ,any rom maker can try to port TV-OUT option from other phones or ROMS ?
Can any rom maker check this thread please.
http://forum.xda-developers.com/showthread.php?t=674041
There is few people trying to port tv out apk to hero.
Bump
There is 3 file i found, copied but looks didnt worked. I tried to install tvout apk but got an error " Application not installed".
system/app/TVOUT.apk
system/app/TVOUT.odex
system/lib/libTVOUT.so
I found new post here : http://forum.xda-developers.com/showthread.php?t=750043
They are talking about services.jar file and kernel.
If can someone help me please post here. And where the hell is services.jar file. Thanks.
Originally Posted by adrynalyne View Post
Does anyone here know which part of the framework also controls TV-OUT? Its not just the apk.
Turns out that there are kernel drivers necessary - there's a framebuffer TVOut driver as well as a USB projector gadget driver. These are built into the CM6 kernel (the one packaged in the nightly builds, not the cm-kernel tree) and obviously the latest RUU from HTC.
Not only that, at least under CM6, there's both fb0 and fb1 display devices present (/dev/display/). I'm assuming the fb1 display is for TV Out.
This leads me to believe that it is most definitely a non-kernel matter, which should help focus efforts (unless you have a vanilla AOSP kernel, in which case it will require kernel driver porting).
logcat/the kernel still doesn't recognize the USB device when I plug in the cable, and I'm not sure what to do at this point.
Click to expand...
Click to collapse
anyone know where is services.jar file in our phone??
/system/framework
Sent from my HTC_A510c using Tapatalk
Codes from our wildfire s
services.jar\classes.dex\com\android\server\TVOUTCableObserver.class
Any clue ???
Code:
public class TVOUTCableObserver
{
private Context mContext;
private BroadcastReceiver receiver = new BroadcastReceiver()
{
private final int TVOUT_BIT = 256;
private int oldState;
public void onReceive(Context paramContext, Intent paramIntent)
{
int i = paramIntent.getIntExtra("state", 0);
paramIntent.getStringExtra("name");
paramIntent.getIntExtra("microphone", 0);
int j = i & 0x100;
if (j != this.oldState)
{
if (j <= 0)
break label73;
TVOUTCableObserver.this.log("plug");
ActivityManagerNative.broadcastStickyIntent(new Intent("android.intent.action.CABLE_PLUG"), null);
}
while (true)
{
this.oldState = j;
return;
label73: TVOUTCableObserver.this.log("unplug");
ActivityManagerNative.broadcastStickyIntent(new Intent("android.intent.action.CABLE_UNPLUG"), null);
}
}
};
public TVOUTCableObserver(Context paramContext)
{
this.mContext = paramContext;
}
private void log(String paramString)
{
}
public void start()
{
IntentFilter localIntentFilter = new IntentFilter("android.intent.action.HEADSET_PLUG");
this.mContext.registerReceiver(this.receiver, localIntentFilter);
}
public void stop()
{
this.mContext.unregisterReceiver(this.receiver);
}
}
And this is from Galaxy S
services.jar\classes.dex\com\android\server\TvOutService.class
There is no TVOUTCableObserver.class.
So is it posibble to delete our TVOUTCableObserver.class and replace TvOutService.class from galaxy s?
Code:
package com.android.server;
import android.app.ActivityManagerNative;
import android.app.Notification;
import android.content.BroadcastReceiver;
import android.content.ContentResolver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.database.ContentObserver;
import android.graphics.Bitmap;
import android.graphics.Bitmap.Config;
import android.graphics.Canvas;
import android.hardware.TvOut;
import android.os.Handler;
import android.os.ITvOutService;
import android.os.ITvOutService.Stub;
import android.os.PowerManager;
import android.os.PowerManager.WakeLock;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.SystemProperties;
import android.provider.Settings.System;
import android.util.Log;
import android.view.IRotationWatcher.Stub;
import android.view.IWindowManager;
import android.view.IWindowManager.Stub;
import android.widget.TextView;
public class TvOutService extends ITvOutService.Stub
{
static final int DEFAULT_TVSTATUS = 0;
static final int DEFAULT_TVSYSTEM = 2;
private static int HDMI_SUBTITLE_HEIGHT = 0;
static final int HDMI_SUBTITLE_MAX_HEIGHT = 304;
static final int HDMI_SUBTITLE_MAX_WIDTH = 1856;
private static int HDMI_SUBTITLE_WIDTH = 0;
public static final String LOCALE_CHANGE_ACTION = "android.intent.action.locale.changed";
private static final boolean LOG = 1;
private static final String TAG = "TvOut-Observer";
static final int TVSTATUS_OFF = 0;
static final int TVSTATUS_ON = 1;
static final int TVSYSTEM_NTSC = 1;
static final int TVSYSTEM_PAL = 2;
private static boolean mIsScreenOff;
private static boolean mIsTvWaitResume;
private static boolean mTvCableConnected;
private static boolean mTvSuspend;
private static int sRotation = 0;
private static IWindowManager sWindowManager;
private Bitmap bitmap_subtitle = null;
private Canvas canvas_subtile = null;
private Context mContext;
Handler mHandler;
private Notification mHeadsetNotification;
final Object mLock = new Object();
private boolean mPlaySounds;
private int mPrevFontSize = 0;
private String mPrevSubtitle = "";
private final BroadcastReceiver mReceiver = new BroadcastReceiver()
{
public void onReceive(Context paramContext, Intent paramIntent)
{
String str = paramIntent.getAction();
Log.i("TvOut-Observer", "ACTION " + str);
Log.i("TvOut-Observer", " tvOutSetImageString BroadcastReceiver broadcast received");
if ("android.intent.action.locale.changed".equals(str))
{
Log.i("TvOut-Observer", " tvOutSetImageString BroadcastReceiver broadcast received");
TvOutService.this.tvOutSetImageString();
}
if ("android.intent.action.SCREEN_OFF".equals(str))
{
Log.i("TvOut-Observer", "ACTION_SCREEN_OFF");
TvOutService.access$602(true);
TvOutService.this.updateTVoutOnScreenOnOff();
}
while (true)
{
return;
if (!("android.intent.action.SCREEN_ON".equals(str)))
continue;
Log.i("TvOut-Observer", "ACTION_SCREEN_ON ");
TvOutService.access$602(false);
TvOutService.this.updateTVoutOnScreenOnOff();
}
}
};
private int mTvStatus;
private int mTvSystem = -1;
private PowerManager.WakeLock mWakeLock = null;
private TvOut tvout;
static
{
mTvCableConnected = false;
mTvSuspend = false;
mIsTvWaitResume = false;
HDMI_SUBTITLE_WIDTH = 0;
HDMI_SUBTITLE_HEIGHT = 0;
mIsScreenOff = false;
}
public TvOutService(Context paramContext)
{
Log.e("TvOut-Observer", "TVOU_DEBUG TvOutService");
this.mContext = paramContext;
this.mPlaySounds = SystemProperties.get("persist.service.mount.playsnd", "1").equals("1");
init();
sWindowManager = IWindowManager.Stub.asInterface(ServiceManager.getService("window"));
if (sWindowManager != null);
try
{
sRotation = sWindowManager.watchRotation(new IRotationWatcher.Stub()
{
public void onRotationChanged(int paramInt)
{
TvOutService.onRotationChanged(paramInt);
}
});
return;
}
catch (RemoteException localRemoteException)
{
}
}
public static void onRotationChanged(int paramInt)
{
ITvOutService localITvOutService = ITvOutService.Stub.asInterface(ServiceManager.getService("tvoutservice"));
if (localITvOutService == null)
Log.e("TvOut-Observer", " setTvoutOrientation TvOutService Not running");
while (true)
{
return;
if (sRotation == paramInt)
continue;
sRotation = paramInt;
try
{
Log.i("TvOut-Observer", "setTvoutOrientation rotation = " + paramInt);
localITvOutService.SetOrientation(paramInt);
}
catch (RemoteException localRemoteException)
{
Log.e("TvOut-Observer", "setTvoutOrientation ", localRemoteException);
}
}
}
private void stayAwake(boolean paramBoolean)
{
if (this.mWakeLock != null)
if ((paramBoolean) && (!(this.mWakeLock.isHeld())))
{
Log.e("TvOut-Observer", "stayAwake Accuring the lock SCREEN_ON_DEBUG");
this.mWakeLock.acquire();
}
while (true)
{
return;
if ((paramBoolean) || (!(this.mWakeLock.isHeld())))
continue;
Log.e("TvOut-Observer", "stayAwake relesing the lock SCREEN_ON_DEBUG");
this.mWakeLock.release();
continue;
Log.e("TvOut-Observer", "stayAwake mWakeLock is null SCREEN_ON_DEBUG");
}
}
private int textSizeForSubtitle()
{
switch (HDMI_SUBTITLE_HEIGHT)
{
default:
case 120:
case 144:
case 180:
case 270:
}
for (int i = 37; ; i = 37)
while (true)
{
Log.e("TvOut-Observer", "textSizeForSubtitle subtitletextsize = " + i);
return i;
i = 16;
continue;
i = 20;
continue;
i = 25;
}
}
private void tvOutSetImageString()
{
String str = this.mContext.getString(17040351);
Log.i("TvOut-Observer", "tvOutSetImageString " + str);
this.tvout.TvOutSetImageString(str);
}
private void updatescreensize()
{
Log.e("TvOut-Observer", "updatescreensize");
}
private void updatetvstatus()
{
Log.e("TvOut-Observer", "updatetvstatus");
if (this.mTvStatus == 0)
{
Log.i("TvOut-Observer", "updatetvstatus tvstatus off mTvCableConnected : " + mTvCableConnected);
if ((this.tvout.isEnabled()) || (isSuspended()))
{
Intent localIntent3 = new Intent("android.intent.action.TVOUT_PLUG");
localIntent3.addFlags(1073741824);
localIntent3.putExtra("state", 0);
localIntent3.putExtra("name", "h2w");
localIntent3.putExtra("microphone", 0);
ActivityManagerNative.broadcastStickyIntent(localIntent3, null);
Log.i("TvOut-Observer", "ACTION_TVOUT_PLUG : disable");
Intent localIntent4 = new Intent("android.intent.action.HEADSET_PLUG");
localIntent4.addFlags(1073741824);
localIntent4.putExtra("state", 1);
localIntent4.putExtra("name", "h2w");
localIntent4.putExtra("microphone", 0);
ActivityManagerNative.broadcastStickyIntent(localIntent4, null);
Log.i("TvOut-Observer", "ACTION_HEADSET_PLUG : enable");
DisableTvOut();
setTvoutCableConnected(0);
}
}
while (true)
{
return;
if (this.mTvStatus == 1)
{
Log.i("TvOut-Observer", "updatetvstatus tvstatus on mTvCableConnected : " + mTvCableConnected);
if ((this.tvout.isEnabled()) || (mTvCableConnected != true))
continue;
Log.i("TvOut-Observer", "updatetvstatus enable tvout mTvCableConnected : " + mTvCableConnected);
Intent localIntent1 = new Intent("android.intent.action.HEADSET_PLUG");
localIntent1.addFlags(1073741824);
localIntent1.putExtra("state", 0);
localIntent1.putExtra("name", "h2w");
localIntent1.putExtra("microphone", 0);
ActivityManagerNative.broadcastStickyIntent(localIntent1, null);
Log.i("TvOut-Observer", "ACTION_HEADSET_PLUG : disable");
Intent localIntent2 = new Intent("android.intent.action.TVOUT_PLUG");
localIntent2.addFlags(1073741824);
localIntent2.putExtra("state", 1);
localIntent2.putExtra("name", "h2w");
localIntent2.putExtra("microphone", 0);
ActivityManagerNative.broadcastStickyIntent(localIntent2, null);
Log.i("TvOut-Observer", "ACTION_TVOUT_PLUG : enable");
EnableTvOut();
setTvoutCableConnected(1);
}
Log.e("TvOut-Observer", "updatetvsystem system shuldnot come here... error in tvout status values");
}
}
private void updatetvsystem()
{
Log.e("TvOut-Observer", "updatetvsystem");
this.tvout.SetTvSystem(this.mTvSystem);
}
public void CableConnected(boolean paramBoolean)
{
Log.e("TvOut-Observer", "CableConnected : " + paramBoolean);
mTvCableConnected = paramBoolean;
if (paramBoolean == true)
{
setTvoutCableConnected(1);
label40: if ((this.mTvStatus != 0) && (mTvCableConnected))
break label94;
Log.i("TvOut-Observer", "CableConnected tvstatus off mTvCableConnected : " + mTvCableConnected);
DisableTvOut();
}
while (true)
{
return;
setTvoutCableConnected(0);
break label40:
label94: if (this.mTvStatus != 1)
continue;
Log.i("TvOut-Observer", "CableConnected tvstatus on mTvCableConnected : " + mTvCableConnected);
if ((!(this.tvout.isEnabled())) && (mTvCableConnected == true))
{
Log.i("TvOut-Observer", "CableConnected enable tvout mTvCableConnected : " + mTvCableConnected);
if (!(mIsScreenOff))
EnableTvOut();
Log.i("TvOut-Observer", "CableConnected enable tvout mIsScreenOff : " + mIsScreenOff);
}
Log.e("TvOut-Observer", "updatetvsystem system shuldnot come here... error in tvout status values");
}
}
public void DisableTvOut()
{
Log.e("TvOut-Observer", "DisableTvOut");
this.tvout.DisableTvOut();
stayAwake(false);
mTvSuspend = false;
mIsTvWaitResume = false;
}
public void DisableTvOutForce()
{
Log.e("TvOut-Observer", "DisableTvOut");
Intent localIntent1 = new Intent("android.intent.action.TVOUT_PLUG");
localIntent1.addFlags(1073741824);
localIntent1.putExtra("state", 0);
localIntent1.putExtra("name", "h2w");
localIntent1.putExtra("microphone", 0);
ActivityManagerNative.broadcastStickyIntent(localIntent1, null);
Log.i("TvOut-Observer", "ACTION_TVOUT_PLUG : disable");
Intent localIntent2 = new Intent("android.intent.action.HEADSET_PLUG");
localIntent2.addFlags(1073741824);
localIntent2.putExtra("state", 1);
localIntent2.putExtra("name", "h2w");
localIntent2.putExtra("microphone", 0);
ActivityManagerNative.broadcastStickyIntent(localIntent2, null);
Log.i("TvOut-Observer", "ACTION_HEADSET_PLUG : enable");
this.tvout.DisableTvOut();
stayAwake(false);
mTvSuspend = false;
mIsTvWaitResume = false;
}
public void EnableTvOut()
{
Log.i("TvOut-Observer", "EnableTvOut");
tvOutSetImageString();
this.tvout.SetOrientation(sRotation);
if (this.tvout.isEnabled())
DisableTvOut();
if ((mTvCableConnected != true) || (this.mTvStatus != 1))
return;
this.tvout.EnableTvOut();
stayAwake(true);
}
public void EnableTvOutForce()
{
Log.e("TvOut-Observer", "EnableTvOut");
Intent localIntent1 = new Intent("android.intent.action.HEADSET_PLUG");
localIntent1.addFlags(1073741824);
localIntent1.putExtra("state", 0);
localIntent1.putExtra("name", "h2w");
localIntent1.putExtra("microphone", 0);
ActivityManagerNative.broadcastStickyIntent(localIntent1, null);
Log.i("TvOut-Observer", "ACTION_HEADSET_PLUG : disable");
Intent localIntent2 = new Intent("android.intent.action.TVOUT_PLUG");
localIntent2.addFlags(1073741824);
localIntent2.putExtra("state", 1);
localIntent2.putExtra("name", "h2w");
localIntent2.putExtra("microphone", 0);
ActivityManagerNative.broadcastStickyIntent(localIntent2, null);
Log.i("TvOut-Observer", "ACTION_TVOUT_PLUG : enable");
this.tvout.SetOrientation(sRotation);
this.tvout.EnableTvOut();
stayAwake(true);
}
public void SetCableStatus(boolean paramBoolean)
{
Log.i("TvOut-Observer", "SetCableStatus : " + paramBoolean);
mTvCableConnected = paramBoolean;
}
public void SetOrientation(int paramInt)
{
Log.e("TvOut-Observer", "SetOrientation");
this.tvout.SetOrientation(paramInt);
}
public void TvOutResume()
{
Log.e("TvOut-Observer", "TvOutResume");
if (mTvSuspend == true)
if ((!(this.tvout.isEnabled())) || (isTvoutCableConnected()))
{
Log.e("TvOut-Observer", "Call Tvout resume");
this.tvout.SetOrientation(sRotation);
this.tvout.TvOutResume(3);
mTvSuspend = false;
mIsTvWaitResume = true;
}
while (true)
{
return;
Log.e("TvOut-Observer", "tvout.isEnabled()" + this.tvout.isEnabled());
continue;
Log.e("TvOut-Observer", "mTvSuspend " + mTvSuspend);
}
}
public void TvOutSetImage(int paramInt)
{
Log.e("TvOut-Observer", "TvOutSetImage");
if (!(this.tvout.isEnabled()))
return;
}
public void TvOutSuspend(String paramString)
{
if ((!(this.tvout.isEnabled())) && (!(this.tvout.isSuspended())))
return;
TvOutSuspendAnalog(paramString);
}
public void TvOutSuspendAnalog(String paramString)
{
Log.e("TvOut-Observer", "TvOutSuspend");
if (isTvoutCableConnected())
if ((!(mTvSuspend)) || (mIsTvWaitResume == true))
{
Log.e("TvOut-Observer", "Call Suspend");
this.tvout.TvOutSuspend(this.mContext, paramString);
mTvSuspend = true;
mIsTvWaitResume = false;
}
while (true)
{
return;
Log.e("TvOut-Observer", "mTvSuspend" + mTvSuspend + " mIsTvWaitResume" + mIsTvWaitResume);
continue;
Log.e("TvOut-Observer", "isTvoutCableConnected()" + isTvoutCableConnected());
}
}
public boolean TvoutSubtitleIsEnable()
{
Log.e("TvOut-Observer", "isHDMISubtitleOn");
return this.tvout.TvoutSubtitleIsEnable();
}
public boolean TvoutSubtitlePostString(String paramString, int paramInt)
{
Log.e("TvOut-Observer", "TvoutSubtitlePostString string = " + paramString + " fontsize : " + paramInt);
int i = 0;
textSizeForSubtitle();
if ((this.mPrevSubtitle.equals(paramString)) && (this.mPrevFontSize == paramInt));
for (int i1 = 0; ; i1 = 1)
{
TextView localTextView;
Bitmap localBitmap;
while (true)
{
return i1;
localTextView = new TextView(this.mContext);
localTextView.setDrawingCacheQuality(524288);
localTextView.setGravity(17);
localTextView.setTextSize((float)(0.8D * paramInt));
localTextView.layout(0, 0, HDMI_SUBTITLE_WIDTH, HDMI_SUBTITLE_HEIGHT);
localTextView.setDrawingCacheBackgroundColor(-16777216);
localTextView.setText(paramString);
localTextView.setDrawingCacheEnabled(true);
localTextView.invalidate();
localTextView.buildDrawingCache();
localBitmap = localTextView.getDrawingCache();
if (localBitmap != null)
break;
Log.e("TvOut-Observer", "TvoutHDMIPostSubtitle bitmap is null ");
i1 = 0;
}
int j = localTextView.getLineCount();
int k = localTextView.getLineHeight();
int l = HDMI_SUBTITLE_HEIGHT - (j * k);
if (l > 0)
i = l / 2 - (k / 2);
Log.e("TvOut-Observer", "subttle y : " + i);
this.bitmap_subtitle.eraseColor(-16777216);
this.canvas_subtile.drawBitmap(localBitmap, 0, i, null);
this.tvout.TvoutSubtitlePostBitmap(this.bitmap_subtitle, -16777216);
localTextView.setDrawingCacheEnabled(false);
this.mPrevSubtitle = paramString;
this.mPrevFontSize = paramInt;
}
}
public boolean TvoutSubtitleSetStatus(int paramInt)
{
Log.e("TvOut-Observer", "TvoutSubtitleSetStatus :" + paramInt);
if (paramInt > 0)
{
if ((!(isEnabled())) || (isSuspended()) || (TvoutSubtitleIsEnable()))
break label135;
HDMI_SUBTITLE_WIDTH = this.tvout.TvoutSubtitleGetWidth();
HDMI_SUBTITLE_HEIGHT = this.tvout.TvoutSubtitleGetHeight();
this.bitmap_subtitle = Bitmap.createBitmap(HDMI_SUBTITLE_WIDTH, HDMI_SUBTITLE_HEIGHT, Bitmap.Config.RGB_565);
this.bitmap_subtitle.eraseColor(-16777216);
this.canvas_subtile = new Canvas(this.bitmap_subtitle);
}
label135: for (boolean bool = this.tvout.TvoutSubtitleSetStatus(1); ; bool = false)
while (true)
{
return bool;
bool = this.tvout.TvoutSubtitleSetStatus(0);
}
}
public String getIntent()
{
return "android.intent.action.locale.changed";
}
void init()
{
Log.e("TvOut-Observer", "TVOUT_DEBUG_VIVEK_ANALOG1");
this.tvout = new TvOut();
this.mHandler = new Handler();
this.mTvStatus = 0;
SettingsObserver localSettingsObserver = new SettingsObserver(this.mHandler);
Settings.System.putInt(this.mContext.getContentResolver(), "tv_out", 0);
localSettingsObserver.observe();
Log.e("TvOut-Observer", "TVOUT_DEBUG_VIVEK_ANALOG2");
IntentFilter localIntentFilter = new IntentFilter();
localIntentFilter.addAction("android.intent.action.locale.changed");
localIntentFilter.addAction("android.intent.action.SCREEN_OFF");
localIntentFilter.addAction("android.intent.action.SCREEN_ON");
this.mContext.registerReceiver(this.mReceiver, localIntentFilter);
setWakeMode(this.mContext, 6);
Log.e("TvOut-Observer", "TVOUT_DEBUG_VIVEK_ANALOG3");
}
public boolean isEnabled()
{
Log.e("TvOut-Observer", "isEnabled");
return this.tvout.isEnabled();
}
public boolean isSuspended()
{
Log.e("TvOut-Observer", "isSuspended");
return this.tvout.isSuspended();
}
public boolean isTvoutCableConnected()
{
Log.e("TvOut-Observer", "isTvoutCableConnected");
return this.tvout.isTvoutCableConnected();
}
public void setTvoutCableConnected(int paramInt)
{
Log.e("TvOut-Observer", "setTvoutCableConnected");
this.tvout.setTvoutCableConnected(paramInt);
}
public void setWakeMode(Context paramContext, int paramInt)
{
int i = 0;
if (this.mWakeLock != null)
{
if (this.mWakeLock.isHeld())
{
i = 1;
this.mWakeLock.release();
}
this.mWakeLock = null;
}
Log.e("TvOut-Observer", "setWakeMode is called SCREEN_ON_DEBUG");
this.mWakeLock = ((PowerManager)paramContext.getSystemService("power")).newWakeLock(0x20000000 | paramInt, "TvOut-Observer");
Log.e("TvOut-Observer", "setWakeMode setting the mode SCREEN_ON_DEBUG mode : " + paramInt);
if (this.mWakeLock == null)
Log.e("TvOut-Observer", "setWakeMode mWakeLock is null SCREEN_ON_DEBUG");
this.mWakeLock.setReferenceCounted(false);
if (i == 0)
return;
this.mWakeLock.acquire();
}
void updateTVoutOnScreenOnOff()
{
if (mIsScreenOff == true)
{
Log.i("TvOut-Observer", "updateTVoutOnScreenOnOff tvstatus off mTvCableConnected : " + mTvCableConnected);
if ((this.mTvStatus == 1) && (mTvCableConnected == true) && (this.tvout.isEnabled()))
DisableTvOut();
}
while (true)
{
return;
if (this.mTvStatus != 1)
continue;
Log.i("TvOut-Observer", "updateTVoutOnScreenOnOff tvstatus on mTvCableConnected : " + mTvCableConnected);
if ((this.tvout.isEnabled()) || (mTvCableConnected != true))
continue;
Log.i("TvOut-Observer", "CableConnected enable tvout mTvCableConnected : " + mTvCableConnected);
if (!(mIsScreenOff))
EnableTvOut();
Log.i("TvOut-Observer", "updateTVoutOnScreenOnOff enable tvout mIsScreenOff : " + mIsScreenOff);
}
}
class SettingsObserver extends ContentObserver
{
SettingsObserver(Handler paramHandler)
{
super(paramHandler);
}
void observe()
{
Log.e("TvOut-Observer", "observe");
ContentResolver localContentResolver = TvOutService.this.mContext.getContentResolver();
localContentResolver.registerContentObserver(Settings.System.getUriFor("tv_system"), false, this);
localContentResolver.registerContentObserver(Settings.System.getUriFor("tv_out"), false, this);
update();
}
public void onChange(boolean paramBoolean)
{
Log.e("TvOut-Observer", "onChange");
update();
}
public void update()
{
Log.e("TvOut-Observer", "update");
ContentResolver localContentResolver = TvOutService.this.mContext.getContentResolver();
int i = 0;
int j = 0;
synchronized (TvOutService.this.mLock)
{
int k = Integer.parseInt(Settings.System.getString(TvOutService.this.mContext.getContentResolver(), "tv_system"));
if (TvOutService.this.mTvSystem != k)
{
TvOutService.access$102(TvOutService.this, k);
i = 1;
}
int l = Settings.System.getInt(localContentResolver, "tv_out", 0);
if (TvOutService.this.mTvStatus != l)
{
TvOutService.access$202(TvOutService.this, l);
j = 1;
}
if (i != 0)
TvOutService.this.updatetvsystem();
if (j != 0)
TvOutService.this.updatetvstatus();
return;
}
}
}
}
I will make this thread more interesting.
If you find a solution for TVOUT you can get DONATE from me
Another link
Galaxy Player 4.0, 5.0
HDMI Capable
http://forum.xda-developers.com/showthread.php?t=1406174&page=3
Looks its not that hard for real developer.
Any help?
I changed services.jar. Added few tv out files from galaxy s.
But still didnt find a solution for install TVOUT.apk
Tried recovery zip and other force to install apk programs. I dont know whats wrong about TVOUT.apk file.
Any develepor can check TVOUT.apk please?
Have you tried copying and pasting the TVOUT files to /system/app?
MrTaco505 said:
Have you tried copying and pasting the TVOUT files to /system/app?
Click to expand...
Click to collapse
Yes i did. same error. and cant see shortcut on menu or anywhere.

[SOLVED] java.lang.NoSuchMethodError where such a method exists

Hello, I get the following exception in logcat
Code:
E/Xposed (10014): java.lang.NoSuchMethodError: com.android.keyguard.KeyguardSecurityContainer#updateSecurityView(android.view.View,java.lang.Boolean)#exact
and my code is
Code:
public class XposedMod implements IXposedHookLoadPackage {
@Override
public void handleLoadPackage(LoadPackageParam lpparam) throws Throwable {
if ((Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) && (lpparam.packageName.contains("android.keyguard") || lpparam.packageName.contains("com.android.systemui")))
{
Class<?> KeyguardHostView = XposedHelpers.findClass("com.android.keyguard.KeyguardSecurityContainer", lpparam.classLoader);
findAndHookMethod(KeyguardHostView, "updateSecurityView", View.class, Boolean.class, mUpdateSecurityViewHook);
}
}
The method exists here https://github.com/android/platform.../keyguard/KeyguardSecurityContainer.java#L139
What should I do? Thanks for your help!
Code:
findAndHookMethod(KeyguardHostView, "updateSecurityView", View.class, boolean.class, mUpdateSecurityViewHook);
The primitive boolean was to be used instead of the boxed Boolean
Rijul.A said:
Hello, I get the following exception in logcat
Code:
E/Xposed (10014): java.lang.NoSuchMethodError: com.android.keyguard.KeyguardSecurityContainer#updateSecurityView(android.view.View,java.lang.Boolean)#exact
and my code is
Code:
public class XposedMod implements IXposedHookLoadPackage {
@Override
public void handleLoadPackage(LoadPackageParam lpparam) throws Throwable {
if ((Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) && (lpparam.packageName.contains("android.keyguard") || lpparam.packageName.contains("com.android.systemui")))
{
Class<?> KeyguardHostView = XposedHelpers.findClass("com.android.keyguard.KeyguardSecurityContainer", lpparam.classLoader);
findAndHookMethod(KeyguardHostView, "updateSecurityView", View.class, Boolean.class, mUpdateSecurityViewHook);
}
}
The method exists here https://github.com/android/platform.../keyguard/KeyguardSecurityContainer.java#L139
What should I do? Thanks for your help!
Click to expand...
Click to collapse
Make class and paste this content
PHP:
import java.lang.reflect.Method;
import de.robv.android.xposed.XC_MethodHook;
import de.robv.android.xposed.XposedBridge;
import de.robv.android.xposed.XposedHelpers;
public class XposedWrapper {
public static XC_MethodHook.Unhook hookMethod(Class<?> sClass,String method_Name,Object... parameterTypesAndCallback) {
Method method = XposedHelpers.findMethodBestMatch(sClass,method_Name,removeCallback(parameterTypesAndCallback));
XC_MethodHook callback = (XC_MethodHook) parameterTypesAndCallback[parameterTypesAndCallback.length-1];
return XposedBridge.hookMethod(method,callback);
}
private static Object[] removeCallback(Object... args) {
Object[] list = new Object[args.length-1];
for (int i = 0 ; i < args.length ; i++) {
if (!(args[i] instanceof XC_MethodHook)) {
list[i] = args[i];
}
}
return list;
}
}
Now in the xposed class
do like this
PHP:
XposedWrapper.hookMethod(KeyguardHostView, "updateSecurityView", View.class, Boolean.class, new XC_MethodHook() {
@Override
protected void afterHookedMethod(MethodHookParam param) throws Throwable {
XposedBridge.log("Hooked");
}
});

Getting LongPress on Back/Volume Keys (Hooked, But Cant't Get LongPress)

Hello, I've hooked a method to get KeysEvent, but I've ran into 2 problems :
1. Can't get long press.
2. Getting up to 7 events when it's only 1 event, Explain ? I've added a log.i in "if(blabla == VOLUME_DOWN ), When i press that key i get the log 7 times.
Here's the code :
HTML:
public static void init() {
final Class localClass = XposedHelpers.findClass("com.android.internal.policy.impl.PhoneWindowManager", Xposed.CLASS_LOADER);
XposedBridge.hookAllConstructors(localClass, new XC_MethodHook() {
protected void afterHookedMethod(final XC_MethodHook.MethodHookParam paramAnonymousMethodHookParam)
throws Throwable {
}
});
XposedHelpers.findAndHookMethod(localClass, "interceptKeyBeforeQueueing", KeyEvent.class, Integer.TYPE, new XC_MethodHook() {
[user=439709]@override[/user]
protected void beforeHookedMethod(MethodHookParam param)
throws Throwable {
KeyEvent event = (KeyEvent) param.args[0];
int code = event.getKeyCode();
if (code == KeyEvent.KEYCODE_BACK) {
Log.i(Xposed.TAG, "Back Pressed");
}
}
});

Boolean Replacement

Hey Guys..
I have a problem with my xposed module.
I will a class to boolean false not true if rooted device..
Code:
public static boolean isRooted()
This to return false if rooted device..
Code:
XposedHelpers.findAndHockMethod("com.example.utils.RootCheck", lpparam.classLoader, "isRooted", boolean.class, new XC_MethodHook() {
@Override
protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
param.args[0] = false;
}
});
Xposed say me nosuchmethoderror com.example.utils.RootCheck#isRooted(boolean)..
Can help me..
Thanks
Sorry for my bad English i m a german.
what class is it, is it your own?
are you filtering by package name?
Is not my own class..
From another Application..
This is the class. i have decoded.
I want replace "public static final String" , public static boolean isRooted() to ever false and private static boolean a(String str) to ever false..
can help me?
Code:
public final class RootCheck {
public static final String VALUE_DEVICE_FLAG_SU = "su";
public static final String VALUE_DEVICE_FLAG_SUPER_USER_APK = "superuser.apk";
public static final String VALUE_DEVICE_FLAG_TEST_KEYS = "testkeys";
private RootCheck() {
}
public static boolean isRooted() {
BuildConfig.IS_PROD.booleanValue();
return false;
}
public static Object[] getFlags() {
int i;
int i2;
List arrayList;
Object[] objArr;
int i3 = 1;
String str = Build.TAGS;
if (str == null || !str.contains("test-keys")) {
i = 0;
} else {
i = 1;
}
try {
if (new File("/system/app/Superuser.apk").exists()) {
i2 = 1;
if (!(a("/system/xbin/which su") || a("/system/bin/which su") || a("which su"))) {
i3 = 0;
}
arrayList = new ArrayList();
if (i3 != 0) {
arrayList.add(VALUE_DEVICE_FLAG_SU);
}
if (i2 != 0) {
arrayList.add(VALUE_DEVICE_FLAG_SUPER_USER_APK);
}
if (i != 0) {
arrayList.add(VALUE_DEVICE_FLAG_TEST_KEYS);
}
objArr = new Object[0];
if (arrayList.isEmpty()) {
return arrayList.toArray(objArr);
}
return objArr;
}
} catch (Exception e) {
}
i2 = 0;
i3 = 0;
arrayList = new ArrayList();
if (i3 != 0) {
arrayList.add(VALUE_DEVICE_FLAG_SU);
}
if (i2 != 0) {
arrayList.add(VALUE_DEVICE_FLAG_SUPER_USER_APK);
}
if (i != 0) {
arrayList.add(VALUE_DEVICE_FLAG_TEST_KEYS);
}
objArr = new Object[0];
if (arrayList.isEmpty()) {
return objArr;
}
return arrayList.toArray(objArr);
}
private static boolean a(String str) {
try {
Runtime.getRuntime().exec(str);
return true;
} catch (Exception e) {
return false;
}
}
}
oh wait, isRooted doesn't take any arguments and you're trying to hook isRooted with a boolean argument, which would be a different method
return values are called result here (getResult, setResult.) args is only for arguments
Oh thx
Code:
06-17 22:21:05.373: E/Xposed(30470): java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.Boolean.booleanValue()' on a null object reference
06-17 22:21:05.373: E/Xposed(30470): at de.bozja.hrh.Hidder$1.beforeHookedMethod(Hidder.java:22)
Error why?
class
Code:
findAndHookMethod("com.example.RootCheck", lpparam.classLoader, "isRooted", new XC_MethodHook() {
@Override
protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
boolean isRoot = (Boolean) param.getResult(); //Error on this line
if(isRoot == true)
isRoot = false;
param.setResult(isRoot);
}
@Override
protected void afterHookedMethod(MethodHookParam param) throws Throwable {
boolean isRoot = (Boolean) param.getResult();
if(isRoot == true)
isRoot = false;
param.setResult(isRoot);
}
});
beforeHookedMethod is called before the method is executed, so there can't be any result. so it's null
Just setresult to false in beforehooked dont add extra junk
And dont hook method afterhook no need before will do what u need
gitfib said:
oh wait, isRooted doesn't take any arguments and you're trying to hook isRooted with a boolean argument, which would be a different method
return values are called result here (getResult, setResult.) args is only for arguments
Click to expand...
Click to collapse
i am also facing the same issue today when trying to hook some certain method that doesnt take in any argument. And i really didnt get the answer you gave. Could you be more elaborate please?
that was a long time. necrobumping from Google?
I think I meant to use param.setResult instead of param.args[0] to set the return value
gitfib said:
that was a long time. necrobumping from Google?
I think I meant to use param.setResult instead of param.args[0] to set the return value
Click to expand...
Click to collapse
thanks. Will try this too. Couldn't find it on Google
gitfib said:
that was a long time. necrobumping from Google?
I think I meant to use param.setResult instead of param.args[0] to set the return value
Click to expand...
Click to collapse
this is the method i want to hook. I want it to return false
public boolean vpn() {
try {
Iterator it = Collections.list(NetworkInterface.getNetworkInterfaces()).iterator();
String str = "";
do {
if (!it.hasNext()) {
return false;
}
NetworkInterface networkInterface = (NetworkInterface) it.next();
if (networkInterface.isUp()) {
str = networkInterface.getName();
}
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append("IFACE NAME: ");
stringBuilder.append(str);
Log.d("DEBUG", stringBuilder.toString());
if (str.contains("tun") || str.contains("ppp")) {
Toast.makeText(getContext(), "Hello vpn detected", 1).show();
}
} while (!str.contains("pptp"));
Toast.makeText(getContext(), "Hello vpn detected", 1).show();
return true;
} catch (SocketException e) {
e.printStackTrace();
}
}
and this is my kotlin class
package app.devzeus.yesvpn.hook
import de.robv.android.xposed.IXposedHookLoadPackage
import de.robv.android.xposed.XC_MethodHook
import de.robv.android.xposed.XposedHelpers
import de.robv.android.xposed.callbacks.XC_LoadPackage
class hook: IXposedHookLoadPackage {
override fun handleLoadPackage(lpparam: XC_LoadPackage.LoadPackageParam?) {
val pakage = "com.eclipse.gamonyapp"
val className = "com.eclipse.gamonyapp.Fragments.OffersFragment"
val method = "vpn"
if (lpparam?.packageName == pakage){
XposedHelpers.findAndHookMethod(className, lpparam.classLoader, method, object: XC_MethodHook(){
override fun beforeHookedMethod(param: MethodHookParam?) {
super.beforeHookedMethod(param)
param?.result = false
}
})
}
}
}
am i doing it wrong? it still doesnt work. The class and method locations are correct
devzeus_ke said:
XposedHelpers.findAndHookMethod(className, lpparam.classLoader, method, object: XC_MethodHook(){
override fun beforeHookedMethod(param: MethodHookParam?) {
super.beforeHookedMethod(param)
param?.result = false
}
Click to expand...
Click to collapse
this should be a separate thread imo
XC_MethodHook | Xposed Framework API
api.xposed.info
in Java there would be no need for the super call and the syntax is .setResult, but I'm not sure in Kotlin
gitfib said:
this should be a separate thread imo
XC_MethodHook | Xposed Framework API
api.xposed.info
in Java there would be no need for the super call and the syntax is .setResult, but I'm not sure in Kotlin
Click to expand...
Click to collapse
about the .setResult(false) the compiler suggests .result = false

Categories

Resources