[TUT]Bind codes to KeyPress - C++ or Other Android Development Languages

Code:
public override bool OnKeyDown(Keycode keyCode, KeyEvent e)
{
if (keyCode == Keycode[COLOR="Cyan"].Back[/COLOR])
{
[COLOR="Red"][B]//code here what happens after Pressing Back button[/B][/COLOR]
return true;
}
return base.OnKeyDown(keyCode, e);
}
Change the button u want Back (The one in blue color)
HAPPY CODING~~~

Related

[Q] Volume buttons sound, annoying beep how to change it ?

I cant find the answer on whole net, starting to think that it isnt possible.
I have tried adding many variates of volume.mp3 and ogg's to /system/media/ui but it doesnt work, have searched for ogg mp3 wav's and raw files in system files but can't find a think that matches that awful beep sound.
Someone on a forum said that he saw rom with Piano sounds when he was changing volume.
i hope that someone figure it out already
thanks in advance
RE: Volume buttons sound, annoying beep how to change it ?
Here is my code to force volume keys to change media volume (instead of ringer volume) and then change the beep to a click.
Code:
//Volume controls changed to media volume
@Override public boolean onKeyDown(int keyCode, KeyEvent keyEvent) {
AudioManager audioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE); // Get audioManager
switch (keyCode) {
case (KeyEvent.KEYCODE_VOLUME_UP):
{
audioManager.adjustStreamVolume(AudioManager.STREAM_MUSIC, AudioManager.ADJUST_RAISE, 0);
return true;
}
case (KeyEvent.KEYCODE_VOLUME_DOWN):
{
audioManager.adjustStreamVolume(AudioManager.STREAM_MUSIC, AudioManager.ADJUST_LOWER, 0);
return true;
}
}
return super.onKeyDown(keyCode, keyEvent);
}
@Override public boolean onKeyUp(int keyCode, KeyEvent keyEvent) {
if (keyCode == KeyEvent.KEYCODE_VOLUME_UP || keyCode == KeyEvent.KEYCODE_VOLUME_DOWN)
{
MediaPlayer clickPlayer = MediaPlayer.create(this, R.raw.click);
try {
clickPlayer.prepare();
} catch (IllegalStateException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
clickPlayer.start();
}
return super.onKeyDown(keyCode, keyEvent);
}
Hi cardinalfib,
thansk for your code - it is exactly what I need.
I'm not an expert - could you tell me how I've to use this code?
What file have I to change?
Thanks a lot!
Tim

(REQ) How to Add Kill Long Press Kill Apps+ Long press volume keys to skip tracks

Does anyone know which jar files and smali files/codes( lines) for adding music control and long press back button to kill apps ?
I need name of files and smali codes.
I need it, too
i think its android-policy.jar or services.jar maybe.
i need it too
AW: (REQ) How to Add Kill Long Press Kill Apps+ Long press volume keys to skip tracks
me too
This is what would be added for Settings:
packages/apps/Settings/src/com/android/settings/DevelopmentSettings.java
Code:
packages/apps/Settings/src/com/android/settings/DevelopmentSettings.java
public class DevelopmentSettings extends PreferenceActivity
implements DialogInterface.OnClickListener, DialogInterface.OnDismissListener {
private static final String KILL_APP_LONGPRESS_BACK = "kill_app_longpress_back";
private CheckBoxPreference mKillAppLongpressBack;
addPreferencesFromResource(R.xml.development_prefs);
mKillAppLongpressBack = (CheckBoxPreference) findPreference(KILL_APP_LONGPRESS_BACK);
}
@Override
protected void onResume() {
super.onResume();
mKillAppLongpressBack.setChecked(Settings.Secure.getInt(getContentResolver(),
Settings.Secure.KILL_APP_LONGPRESS_BACK, 0) != 0);
}
@Override
public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) {
} else if (preference == mKillAppLongpressBack) {
Settings.Secure.putInt(getContentResolver(), Settings.Secure.KILL_APP_LONGPRESS_BACK,
mKillAppLongpressBack.isChecked() ? 1 : 0);
}
And for frameworks:
policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
Code:
Runnable mBackLongPress = new Runnable() {
public void run() {
if (Settings.Secure.getInt(mContext.getContentResolver(),
Settings.Secure.KILL_APP_LONGPRESS_BACK, 0) == 0) {
return;
}
try {
performHapticFeedbackLw(null, HapticFeedbackConstants.LONG_PRESS, false);
IActivityManager mgr = ActivityManagerNative.getDefault();
List<RunningAppProcessInfo> apps = mgr.getRunningAppProcesses();
for (RunningAppProcessInfo appInfo : apps) {
int uid = appInfo.uid;
// Make sure it's a foreground USER application
if (uid >= Process.FIRST_APPLICATION_UID && uid <= Process.LAST_APPLICATION_UID
&& appInfo.importance == RunningAppProcessInfo.IMPORTANCE_FOREGROUND) {
// Kill the entire pid
Toast.makeText(mContext, com.android.internal.R.string.app_killed_message, Toast.LENGTH_SHORT).show();
Process.killProcess(appInfo.pid);
break;
}
}
I SAW IT FROM SAMSUNG PHONE, NOT SURE ABOUT OUR SONY
TELL ME IF IT WORKS
TeamIndia said:
This is what would be added for Settings:
packages/apps/Settings/src/com/android/settings/DevelopmentSettings.java
Code:
packages/apps/Settings/src/com/android/settings/DevelopmentSettings.java
public class DevelopmentSettings extends PreferenceActivity
implements DialogInterface.OnClickListener, DialogInterface.OnDismissListener {
private static final String KILL_APP_LONGPRESS_BACK = "kill_app_longpress_back";
private CheckBoxPreference mKillAppLongpressBack;
addPreferencesFromResource(R.xml.development_prefs);
mKillAppLongpressBack = (CheckBoxPreference) findPreference(KILL_APP_LONGPRESS_BACK);
}
@Override
protected void onResume() {
super.onResume();
mKillAppLongpressBack.setChecked(Settings.Secure.getInt(getContentResolver(),
Settings.Secure.KILL_APP_LONGPRESS_BACK, 0) != 0);
}
@Override
public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) {
} else if (preference == mKillAppLongpressBack) {
Settings.Secure.putInt(getContentResolver(), Settings.Secure.KILL_APP_LONGPRESS_BACK,
mKillAppLongpressBack.isChecked() ? 1 : 0);
}
And for frameworks:
policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
Code:
Runnable mBackLongPress = new Runnable() {
public void run() {
if (Settings.Secure.getInt(mContext.getContentResolver(),
Settings.Secure.KILL_APP_LONGPRESS_BACK, 0) == 0) {
return;
}
try {
performHapticFeedbackLw(null, HapticFeedbackConstants.LONG_PRESS, false);
IActivityManager mgr = ActivityManagerNative.getDefault();
List<RunningAppProcessInfo> apps = mgr.getRunningAppProcesses();
for (RunningAppProcessInfo appInfo : apps) {
int uid = appInfo.uid;
// Make sure it's a foreground USER application
if (uid >= Process.FIRST_APPLICATION_UID && uid <= Process.LAST_APPLICATION_UID
&& appInfo.importance == RunningAppProcessInfo.IMPORTANCE_FOREGROUND) {
// Kill the entire pid
Toast.makeText(mContext, com.android.internal.R.string.app_killed_message, Toast.LENGTH_SHORT).show();
Process.killProcess(appInfo.pid);
break;
}
}
I SAW IT FROM SAMSUNG PHONE, NOT SURE ABOUT OUR SONY
TELL ME IF IT WORKS
Click to expand...
Click to collapse
no its completely different...bcz we dont u use kill concept smali...
so we have to mod android.policy.jar
settings.apk
and fw-res.apk..
iam almost making a tut for it...will add it in my tut thread soon..

[Q] Android camera in portrait but playing in landscape

I have this code below. The problem is i set the orientation of camera to portrait, even preview is portrait. But when i playback that video i see it in landscape mode. Do you guys know why and how i can fix this? Is there a way to rotate VideoView when i playback or to rotate video itself after recording..? I beg you, help me, anywhere i ask nobody knows why and how to fix it...
Here is the code:
Code:
public class BetaRecordActivity extends Activity {
private Preview preview;
private Camera camera;
private MediaRecorder recorder;
private int defaultCameraId;
private int videoCount;
[user=439709]@override[/user]
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.beta_record, menu);
return true;
}
[user=439709]@override[/user]
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_beta_record);
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
initCameraAndPreview();
videoCount = 0;
preview.setOnTouchListener(new View.OnTouchListener() {
[user=439709]@override[/user]
public boolean onTouch(View v, MotionEvent event) {
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
releaseCamera();
getThatCamReady();
recorder.start();
videoCount ++;
break;
case MotionEvent.ACTION_MOVE:
break;
case MotionEvent.ACTION_UP:
stopRecording();
break;
}
return true;
}
});
}
[user=439709]@override[/user]
protected void onResume() {
super.onResume();
}
[user=439709]@override[/user]
protected void onPause() {
super.onPause();
}
private boolean getThatCamReady() {
camera = getCameraInstance();
setCameraDisplayOrientation(this, defaultCameraId, camera);
camera.unlock();
recorder = new MediaRecorder();
recorder.setCamera(camera);
recorder.setAudioSource(MediaRecorder.AudioSource.CAMCORDER);
recorder.setVideoSource(MediaRecorder.VideoSource.CAMERA);
recorder.setProfile(CamcorderProfile.get(CamcorderProfile.QUALITY_HIGH));
File tempFile = new File(Environment.getExternalStorageDirectory(), "/rec/temp/video_" + String.valueOf(videoCount) + ".mp4");
recorder.setOutputFile(tempFile.getPath());
recorder.setMaxDuration(12500);
recorder.setMaxFileSize(7000000);
recorder.setPreviewDisplay(preview.getHolder().getSurface());
try {
recorder.prepare();
} catch (IllegalStateException e) {
releaseMediaRecorder();
return false;
} catch (IOException e) {
releaseMediaRecorder();
return false;
}
return true;
}
private void stopRecording() {
//timer.pause();
try {
recorder.stop();
} catch(RuntimeException stopException) {
// Handle the cleanup here
//badList.add(videoCount);
//videoCount--;
//RecordActivity.this.timeLeft.setText(String.valueOf(videoCount));
}
releaseMediaRecorder();
}
private void initCameraAndPreview() {
// Find the total number of cameras available
int numberOfCameras = Camera.getNumberOfCameras();
// Find the ID of the default camera
CameraInfo cameraInfo = new CameraInfo();
for (int i = 0; i < numberOfCameras; i++) {
Camera.getCameraInfo(i, cameraInfo);
if (cameraInfo.facing == CameraInfo.CAMERA_FACING_BACK) {
defaultCameraId = i;
}
}
camera = getCameraInstance();
setCameraDisplayOrientation(this, defaultCameraId, camera);
preview = new Preview(this, camera);
FrameLayout myCameraPreview = (FrameLayout)findViewById(R.id.videoview);
myCameraPreview.addView(preview);
}
private void releaseMediaRecorder(){
if (recorder != null) {
recorder.reset();
recorder.release();
recorder = null;
camera.lock();
}
}
private void releaseCamera(){
if (camera != null){
camera.release();
camera = null;
}
}
private Camera getCameraInstance(){
// TODO Auto-generated method stub
Camera c = null;
try {
c = Camera.open(); // attempt to get a Camera instance
}
catch (Exception e){
// Camera is not available (in use or does not exist)
}
return c; // returns null if camera is unavailable
}
public static void setCameraDisplayOrientation(Activity activity,
int cameraId, android.hardware.Camera camera) {
android.hardware.Camera.CameraInfo info =
new android.hardware.Camera.CameraInfo();
android.hardware.Camera.getCameraInfo(cameraId, info);
int rotation = activity.getWindowManager().getDefaultDisplay()
.getRotation();
int degrees = 0;
switch (rotation) {
case Surface.ROTATION_0: degrees = 0; break;
case Surface.ROTATION_90: degrees = 90; break;
case Surface.ROTATION_180: degrees = 180; break;
case Surface.ROTATION_270: degrees = 270; break;
}
int result;
if (info.facing == Camera.CameraInfo.CAMERA_FACING_FRONT) {
result = (info.orientation + degrees) % 360;
result = (360 - result) % 360; // compensate the mirror
} else { // back-facing
result = (info.orientation - degrees + 360) % 360;
}
camera.setDisplayOrientation(result);
}
}

[Q] How replace css from Webview

I want automatically replace css file when onpagefinished. Manually replace css with javascript i dont want, because my css file have over 2000 lines. I simply want set css to Webview.
Code:
......
final Activity activity = this;
wv.setWebChromeClient(new WebChromeClient() {
public void onProgressChanged(WebView view, int progress)
{
activity.setTitle(" "+LASTURL);
activity.setProgress(progress * 100);
if(progress == 100)
activity.setTitle(" "+LASTURL);
}
});
wv.setWebViewClient(new WebViewClient() {
public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) {
Toast.makeText(getApplicationContext(), "Error: " + description+ " " + failingUrl, Toast.LENGTH_LONG).show();
}
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url)
{
if (url.indexOf("...")<=0) {
// the link is not for a page on my site, so launch another Activity that handles URLs
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
startActivity(intent);
return true;
}
return false;
}
public void onPageStarted (WebView view, String url, Bitmap favicon) {
LASTURL = url;
}
public void onPageFinished (WebView view, String url) {
}
});
wv.loadUrl("...");
}
}

System App reverse enginnering

Hello there!
I would need some help reverse engineering an app and recompiling it with some different code afterwards.
The App coordinates all the different components of my phone to work properly.
When you press the two fingerprint sensors, the app gives you haptic feedback and turns the screen from front to back or vice versa, depending on which side is facing up.
I need the app to do exactly that once when i wake up my phone either with fingerprint or power button, so the display illuminates which is facing up, and not the one i used recently.
I have some experience with java, but all i got are the .smali documents.
Is there any way to reliably get smali into java and back?
Code:
Code:
package org.mokee.settings.keyhandler;
import android.app.KeyguardManager;
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.os.Handler;
import android.os.PowerManager;
import android.os.PowerManager.WakeLock;
import android.os.SystemClock;
import android.os.Vibrator;
import android.provider.Settings.Secure;
import android.provider.Settings.System;
import android.telephony.TelephonyManager;
import android.view.KeyEvent;
import com.android.internal.os.DeviceKeyHandler;
import org.mokee.internal.util.FileUtils;
import org.mokee.internal.util.PowerMenuConstants;
import org.mokee.settings.detector.MotionDetector;
import org.mokee.settings.detector.MotionDetector.MotionListener;
import org.mokee.settings.dualscreen.ScreenHelper;
public class KeyHandler implements DeviceKeyHandler {
private static final long DEBOUNCE_DELAY_MILLIS = 150;
public static final String FINGER_SWITCH_SETTING_KEY = "finger_switch_switch";
public static final String FORCE_FRONT_ON_CALL = "force_front_on_call";
public static final int FP_LEFT_KEY = 133;
public static final int FP_RIGHT_KEY = 134;
private static final int SWITCH_WAKELOCK_DURATION = 3000;
public static final String WAKE_FRONT_ON_CALL = "wake_front_on_call";
/* access modifiers changed from: private */
public static boolean sForceFrontOnRinging = true;
/* access modifiers changed from: private */
public static boolean sInCallRinging = false;
/* access modifiers changed from: private */
public static boolean sPressSwitch = true;
/* access modifiers changed from: private */
public static boolean sScreenTurnedOn = true;
/* access modifiers changed from: private */
public static boolean sWakeFrontOnRinging = true;
private KeyguardManager keyguardManager;
/* access modifiers changed from: private */
public final Context mContext;
private long mLeftFpDownTime = 0;
private boolean mLeftKeyPressed = false;
/* access modifiers changed from: private */
public MotionDetector mMotionDetector;
private final PowerManager mPowerManager;
private long mRightFpDownTime = 0;
private boolean mRightKeyPressed = false;
private final BroadcastReceiver mScreenStateReceiver = new BroadcastReceiver() {
public void onReceive(Context context, Intent intent) {
if (intent.getAction().equals("android.intent.action.SCREEN_OFF")) {
KeyHandler.sScreenTurnedOn = false;
} else if (intent.getAction().equals("android.intent.action.SCREEN_ON")) {
KeyHandler.sScreenTurnedOn = true;
if (KeyHandler.sInCallRinging && KeyHandler.sWakeFrontOnRinging) {
KeyHandler.this.mSwitchScreenHandler.post(new SwitchRunnable(1));
}
} else if (intent.getAction().equals("android.intent.action.PHONE_STATE")) {
if (KeyHandler.this.mTelephonyManager == null) {
KeyHandler.this.mTelephonyManager = (TelephonyManager) KeyHandler.this.mContext.getSystemService("phone");
}
if (KeyHandler.this.mTelephonyManager.getCallState() == 1) {
KeyHandler.sInCallRinging = true;
if (KeyHandler.sScreenTurnedOn && KeyHandler.sForceFrontOnRinging) {
KeyHandler.this.mSwitchScreenHandler.post(new SwitchRunnable(1));
return;
}
return;
}
KeyHandler.sInCallRinging = false;
}
}
};
/* access modifiers changed from: private */
public ScreenHelper mSwitchHelper;
/* access modifiers changed from: private */
public Handler mSwitchScreenHandler;
private WakeLock mSwitchWakeLock;
/* access modifiers changed from: private */
public TelephonyManager mTelephonyManager;
private final Vibrator mVibrator;
class SettingsObserver extends ContentObserver {
public SettingsObserver(Handler handler) {
super(handler);
}
/* access modifiers changed from: 0000 */
public void observe() {
ContentResolver contentResolver = KeyHandler.this.mContext.getContentResolver();
contentResolver.registerContentObserver(System.getUriFor(KeyHandler.WAKE_FRONT_ON_CALL), false, this, -1);
contentResolver.registerContentObserver(System.getUriFor(KeyHandler.FORCE_FRONT_ON_CALL), false, this, -1);
contentResolver.registerContentObserver(System.getUriFor(KeyHandler.FINGER_SWITCH_SETTING_KEY), false, this, -1);
update();
}
public void onChange(boolean z) {
update();
}
/* access modifiers changed from: 0000 */
public void update() {
ContentResolver contentResolver = KeyHandler.this.mContext.getContentResolver();
boolean z = true;
KeyHandler.sPressSwitch = System.getInt(contentResolver, KeyHandler.FINGER_SWITCH_SETTING_KEY, 1) == 1;
KeyHandler.sWakeFrontOnRinging = System.getInt(contentResolver, KeyHandler.WAKE_FRONT_ON_CALL, 1) == 1;
if (System.getInt(contentResolver, KeyHandler.FORCE_FRONT_ON_CALL, 1) != 1) {
z = false;
}
KeyHandler.sForceFrontOnRinging = z;
}
}
private class SwitchRunnable implements Runnable {
private long mSwitchCompleteTime = 0;
private int mTarget;
public SwitchRunnable(int i) {
this.mTarget = i;
}
public void run() {
if (this.mTarget != ScreenHelper.getHelper().getCurrentDisplayId()) {
doSwitch();
}
}
private void doSwitch() {
if (this.mSwitchCompleteTime > 0 && SystemClock.uptimeMillis() - this.mSwitchCompleteTime < 50) {
try {
Thread.sleep(Math.abs(SystemClock.uptimeMillis() - this.mSwitchCompleteTime));
} catch (Exception e) {
}
}
KeyHandler.this.mSwitchHelper.setCurrentDisplay(this.mTarget);
readLcdState(this.mTarget);
KeyHandler.this.mMotionDetector.setCurrentDisplayId(this.mTarget);
FileUtils.writeLine("/sys/class/backlight/panel0-backlight/brightness", FileUtils.readOneLine("/sys/class/backlight/panel0-backlight/brightness"));
this.mSwitchCompleteTime = SystemClock.uptimeMillis();
}
private void readLcdState(int i) {
int i2 = 0;
while (i2 < 200) {
int parseInt = Integer.parseInt(FileUtils.readOneLine("/sys/kernel/lcd_enhance/lcd_state"));
if (i == parseInt || parseInt > 1) {
i2++;
try {
Thread.sleep(10);
} catch (InterruptedException e) {
e.printStackTrace();
}
} else {
return;
}
}
}
}
public KeyHandler(Context context) {
this.mContext = context;
this.mVibrator = (Vibrator) context.getSystemService(Vibrator.class);
this.mPowerManager = (PowerManager) context.getSystemService(PowerMenuConstants.GLOBAL_ACTION_KEY_POWER);
this.mSwitchWakeLock = this.mPowerManager.newWakeLock(1, "NubiaPartsGestureWakeLock:");
IntentFilter intentFilter = new IntentFilter();
intentFilter.addAction("android.intent.action.SCREEN_OFF");
intentFilter.addAction("android.intent.action.SCREEN_ON");
intentFilter.addAction("android.intent.action.PHONE_STATE");
context.registerReceiver(this.mScreenStateReceiver, intentFilter);
this.mSwitchHelper = ScreenHelper.getHelper();
this.mSwitchScreenHandler = new Handler(this.mSwitchHelper.getLooper());
initMotionDetector();
initSettingsObserver();
}
private void initSettingsObserver() {
new SettingsObserver(new Handler()).observe();
}
private void initMotionDetector() {
this.mMotionDetector = new MotionDetector(this.mContext);
this.mMotionDetector.setMotionListener(new MotionListener() {
public void onMotionChange(int i) {
if (KeyHandler.sScreenTurnedOn) {
KeyHandler.this.mSwitchScreenHandler.post(new SwitchRunnable(i));
}
}
});
this.mMotionDetector.setCurrentDisplayId(ScreenHelper.getHelper().getCurrentDisplayId());
}
public KeyEvent handleKeyEvent(KeyEvent keyEvent) {
if (!hasSetupCompleted()) {
return keyEvent;
}
if (this.keyguardManager == null) {
this.keyguardManager = (KeyguardManager) this.mContext.getSystemService(KeyguardManager.class);
}
if (this.keyguardManager.isKeyguardLocked() || !sScreenTurnedOn) {
return keyEvent;
}
int keyCode = keyEvent.getKeyCode();
if (keyCode != 133 && keyCode != 134) {
return keyEvent;
}
boolean z = true;
if (keyEvent.getAction() != 1) {
z = false;
}
if (z) {
return interceptFpKeyUp(keyEvent);
}
return interceptFpKeyDown(keyEvent);
}
private KeyEvent interceptFpKeyDown(KeyEvent keyEvent) {
switch (keyEvent.getKeyCode()) {
case 133:
if (!this.mLeftKeyPressed && (keyEvent.getFlags() & 1024) == 0) {
this.mLeftKeyPressed = true;
this.mLeftFpDownTime = keyEvent.getDownTime();
triggerDoubleFpAction();
break;
}
case 134:
if (!this.mRightKeyPressed && (keyEvent.getFlags() & 1024) == 0) {
this.mRightKeyPressed = true;
this.mRightFpDownTime = keyEvent.getDownTime();
triggerDoubleFpAction();
break;
}
}
return null;
}
private KeyEvent interceptFpKeyUp(KeyEvent keyEvent) {
switch (keyEvent.getKeyCode()) {
case 133:
this.mLeftKeyPressed = false;
this.mLeftFpDownTime = 0;
break;
case 134:
this.mRightKeyPressed = false;
this.mRightFpDownTime = 0;
break;
}
if (this.mMotionDetector.isEnable()) {
this.mMotionDetector.disable();
}
return null;
}
private void triggerDoubleFpAction() {
if (this.mLeftKeyPressed && this.mRightKeyPressed && sPressSwitch) {
long uptimeMillis = SystemClock.uptimeMillis();
if (uptimeMillis <= this.mLeftFpDownTime + DEBOUNCE_DELAY_MILLIS && uptimeMillis <= this.mRightFpDownTime + DEBOUNCE_DELAY_MILLIS) {
this.mSwitchWakeLock.acquire(3000);
doHapticFeedback();
this.mMotionDetector.enable();
}
}
}
private void doHapticFeedback() {
if (this.mVibrator != null && this.mVibrator.hasVibrator()) {
this.mVibrator.vibrate(50);
}
}
private boolean hasSetupCompleted() {
return Secure.getInt(this.mContext.getContentResolver(), "user_setup_complete", 0) != 0;
}
}
Sorry for my bad english!
Thanks!
Tom04 said:
Hello there!
I would need some help reverse engineering an app and recompiling it with some different code afterwards.
The App coordinates all the different components of my phone to work properly.
When you press the two fingerprint sensors, the app gives you haptic feedback and turns the screen from front to back or vice versa, depending on which side is facing up.
I need the app to do exactly that once when i wake up my phone either with fingerprint or power button, so the display illuminates which is facing up, and not the one i used recently.
I have some experience with java, but all i got are the .smali documents.
Is there any way to reliably get smali into java and back?
Code:
Sorry for my bad english!
Thanks!
Click to expand...
Click to collapse
Try APKtool, open source, most used out there.
"apktool d (nameof the app).apk"
"apktool b (name of the app).apk" to recompile
If it's a system file, make sure you don't modify the original signature by adding -c to the last command.
Have a good day

Categories

Resources