FindViewById from hooked method? - Xposed Framework Development

Hello!
I'm trying to make Xposed module from this patch: https://github.com/CyanogenMod/android_frameworks_base/commit/19e458f4a26fe7c8b6419cadba81a0c46dc79dad
My code looks like this:
Code:
@Override
public void initZygote(StartupParam startupParam) throws Throwable {
MODULE_PATH = startupParam.modulePath;
}
@Override
public void handleInitPackageResources(XC_InitPackageResources.InitPackageResourcesParam resparam) throws Throwable {
if (!resparam.packageName.equals(PACKAGE_NAME))
return;
XModuleResources modRes = XModuleResources.createInstance(MODULE_PATH, resparam.res);
mFakeIdScrimview = resparam.res.addResource(modRes, R.id.scrimview);
mFakeIdVisView = resparam.res.addResource(modRes, R.id.visualizerview);
}
public void handleLoadPackage(final LoadPackageParam lpparam) throws Throwable {
if (!lpparam.packageName.equals(PACKAGE_NAME))
return;
findAndHookMethod("com.android.systemui.statusbar.phone.PhoneStatusBar", lpparam.classLoader,
"makeStatusBarView", new XC_MethodHook() {
@Override
protected void afterHookedMethod(MethodHookParam param) throws Throwable {
FrameLayout lStatusBarWindow = (FrameLayout) XposedHelpers.getObjectField(param.thisObject, "mStatusBarWindow");
FrameLayout scrimView = (FrameLayout) lStatusBarWindow.findViewById(mFakeIdScrimview);
if (scrimView != null) {
mVisualizerView = (VisualizerView) scrimView.findViewById(mFakeIdVisView);
} else {
XposedBridge.log("scrimView = null !!!!");
}
if (mVisualizerView != null){
mVisualizerView.setKeyguardMonitor(mKeyguardMonitor);
} else {
XposedBridge.log("mVisualizerView = null !!!!! ");
}
}
});
The problem is that scrimView is always null and I can't get this piece of code working.
Anybody has any idea?

Untested, but could you try to replace your scrimView assignment line with this
Code:
FrameLayout scrimView = (FrameLayout) XposedHelpers.callMethod(lStatusBarWindow, "findViewById", mFakeIdScrimview);

Rijul.A said:
Untested, but could you try to replace your scrimView assignment line with this
Code:
FrameLayout scrimView = (FrameLayout) XposedHelpers.callMethod(lStatusBarWindow, "findViewById", mFakeIdScrimview);
Click to expand...
Click to collapse
Unfortunately scrimView is still null.

Related

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");
}
}
});

Hook long press notification

How can you guys capture long press notification?
I found this method on SystemUI:
Code:
Code:
protected SwipeHelper.LongPressListener getNotificatioLongnClicker() {
return new SwipeHelper.LongPressListener() {
[user=439709]@override[/user]
public boolean onLongPress(View v, int x, int y) {...
But I can't do afterHookedMethod or beforeHookedMethod.
Code:
Code:
public class Tutorial implements IXposedHookLoadPackage {
public void handleLoadPackage(final LoadPackageParam lpparam) throws Throwable {
XposedBridge.log("Loaded app: " + lpparam.packageName);
if (!lpparam.packageName.equals("com.android.systemui"))
return;
findAndHookMethod("com.android.systemui.statusbar.BaseStatusBar", lpparam.classLoader, "getNotificationLongClicker", new XC_MethodHook() {
[user=439709]@override[/user]
protected void afterHookedMethod (MethodHookParam param) throws Throwable {
// this will be called before the clock was updated by the original method
return new View.OnLongClickListener() {
[user=439709]@override[/user]
public boolean onLongClick(final View v) {
XposedBridge.log("long press notification action");
return true;
}
}
});
}
}
}
How I can call the method from another class "SwipeHelper" and access "LongPressListener" public interface and "onLongPress" method which return boolean value?
I tried with object and method "View.OnLongClickListener" without success. Anyway, if I can't do it there is another way because I see system long press notification working on xNotification module.
PS.: I'm noobie: http://stackoverflow.com/questions/3...ing-xposed-mod
@pixeltech.dev
lukakas said:
How can you guys capture long press notification?
I found this method on SystemUI:
Code:
Code:
protected SwipeHelper.LongPressListener getNotificatioLongnClicker() {
return new SwipeHelper.LongPressListener() {
[user=439709]@override[/user]
public boolean onLongPress(View v, int x, int y) {...
But I can't do afterHookedMethod or beforeHookedMethod.
Code:
Code:
public class Tutorial implements IXposedHookLoadPackage {
public void handleLoadPackage(final LoadPackageParam lpparam) throws Throwable {
XposedBridge.log("Loaded app: " + lpparam.packageName);
if (!lpparam.packageName.equals("com.android.systemui"))
return;
findAndHookMethod("com.android.systemui.statusbar.BaseStatusBar", lpparam.classLoader, "getNotificationLongClicker", new XC_MethodHook() {
[user=439709]@override[/user]
protected void afterHookedMethod (MethodHookParam param) throws Throwable {
// this will be called before the clock was updated by the original method
return new View.OnLongClickListener() {
[user=439709]@override[/user]
public boolean onLongClick(final View v) {
XposedBridge.log("long press notification action");
return true;
}
}
});
}
}
}
How I can call the method from another class "SwipeHelper" and access "LongPressListener" public interface and "onLongPress" method which return boolean value?
I tried with object and method "View.OnLongClickListener" without success. Anyway, if I can't do it there is another way because I see system long press notification working on xNotification module.
PS.: I'm noobie: http://stackoverflow.com/questions/3...ing-xposed-mod
@pixeltech.dev
Click to expand...
Click to collapse
Hi, View.OnLongClickListener is not a method, it's an interface. Basically what you need to do is get the method result in your hook (it would be either SwipeHelper or OnClickListener based on your Andorid version) and use it based on its methods and your needs
pixeltech.dev said:
Hi, View.OnLongClickListener is not a method, it's an interface. Basically what you need to do is get the method result in your hook (it would be either SwipeHelper or OnClickListener based on your Andorid version) and use it based on its methods and your needs
Click to expand...
Click to collapse
I tried to do this without success:
Code:
public class Tutorial implements IXposedHookLoadPackage {
public void handleLoadPackage(final LoadPackageParam lpparam) throws Throwable {
XposedBridge.log("Loaded app: " + lpparam.packageName);
if (!lpparam.packageName.equals("com.android.systemui"))
return;
findAndHookMethod("com.android.systemui.statusbar.SwipeHelper$LongPressListener", lpparam.classLoader, "onLongPress",View.class, Integer.TYPE, Integer.TYPE, new XC_MethodHook() {
@Override
protected void afterHookedMethod (MethodHookParam param) throws Throwable {
// this will be called before the clock was updated by the original method
XposedBridge.log("long press notification action");
}
});
}
}
Logcat:
Code:
05-30 22:35:13.580 18201-18201/com.android.systemui E/Xposed: java.lang.IllegalArgumentException: Cannot hook interfaces: public abstract boolean com.android.systemui.SwipeHelper$LongPressListener.onLongPress(android.view.View,int,int)

Get TextView from method [RESOLVED]

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).

Categories

Resources