[Q] How can I get start to understand .smali? - Android Q&A, Help & Troubleshooting

Hello everyone. I am a complete novice to .smali.
I did made some search before that .smali is similar to .dex, but I merely know a line with java.
Well, for the very first thing, I would like to know what should I first learn to understand .smali?
Next, please look at the line below:
" } else if (keyCode == KeyEvent.KEYCODE_APP_SWITCH) {
if (down && repeatCount == 0) {
showOrHideRecentAppsDialog(RECENT_APPS_BEHAVIOR_SHOW_OR_DISMISS);
}
return -1;
} "
This is a java line, am I correct? Then how will it looks like in .smali file?
Thx man!

Related

[R&D] Upload files with DropBox

Hi, this is my code, i cant get upload a simple file:
Signgin in to DropBox:
.....private AccessTokenPair tokensDB;
.....private DropboxAPI<AndroidAuthSession> mDBApi;
.....final static private AccessType ACCESS_TYPE = AccessType.DROPBOX;
.....AppKeyPair appKeys = new AppKeyPair(APP_KEY, APP_SECRET);
.....AndroidAuthSession sesDropBox = new AndroidAuthSession(appKeys, ACCESS_TYPE);
.....mDBApi = new DropboxAPI<AndroidAuthSession>(sesDropBox);
.....mDBApi.getSession().startAuthentication(this);
When activity resums this code is executed:
.....mDBApi.getSession().finishAuthentication();
.....tokensDB = mDBApi.getSession().getAccessTokenPair();
when the user clicks over a button in same activity next code is executed:
protected void subeArchivos() {
.....// Uploading content.
.....String fileContents = "Hello World, this is only an example!!";
.....ByteArrayInputStream inputStream = new ByteArrayInputStream(fileContents.getBytes());
.....try {
..........mDBApi.putFile("/testing.txt", inputStream, fileContents.length(), null, null);
..........//Log.i("DbExampleLog", "The uploaded file's rev is: " + newEntry.rev);
.....} catch (DropboxUnlinkedException e) {
..........// User has unlinked, ask them to link again here.
..........Log.e("DbExampleLog", "User has unlinked.");
.....} catch (DropboxException e) {
..........toast = Toast.makeText(getApplicationContext(), "C U A: " + e.getMessage(), Toast.LENGTH_SHORT);
..........toast.show();
..........//Log.e("DbExampleLog", "Something went wrong while uploading.");
.....}
}
The code in red throws error. and after the conde in yellow is executed.
My mnifiest permissions are:
.....<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"></uses-permission>
.....<uses-permission android:name="android.permission.INTERNET"></uses-permission>
.....<uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS"></uses-permission>
P.D. All works, exept code in red!!
I hope you can help me!! thx!!
anyone??
I didn't understand anything exc. that you can't upload any file with Dropbox, but I had similar problem. Seems you shouldn't delete the Downloads app, else it bugs DB uploads.
Hope it helps.
thx man, every folder in his place, but maybe something in my code is wrong!!

[SAMPLE]C# Process status

In this code you can check whether the app you want is running or not.
Code:
using System.Diagnostics;
Code:
Process[] myApp = Process.GetProcessesByName("notepad");
if (myApp.Length == 0)
MessageBox.Show("Process Not Found");
else
MessageBox.Show("Process Found");
Where the "notepad", place your app name there.
I guess you can understand it.
HAPPY CODING!

isVoiceCapable returning the wrong value

Hello dear modders, hackers, vagabonds, ladies and gentlemen!
The device I'm using is the p5110.
I've moddified isVoiceCapable in /frameworks/base/telephony/java/android/telephony/ to look like this:
Code:
public boolean isVoiceCapable() {
Log.d("Cancantest", "Is context null? " + (sContext==null));
if (sContext == null) return true;
Log.d("Cancantest", "Boolean value is " + (sContext.getResources().getBoolean(
com.android.internal.R.bool.config_voice_capable)) );
return sContext.getResources().getBoolean(
com.android.internal.R.bool.config_voice_capable);
}
and my /frameworks/base/core/res/res/values/config.xml contains
Code:
<bool name="config_voice_capable">true</bool>
but for some reason, the logcat output of the logs I've put in are:
Code:
D/Cancantest( 1672): Is context null? false
D/Cancantest( 1672): Boolean value is false
Am I missing a setting somewhere else?
Edit: By the way, I'm calling isVoiceCapable() from Settings.apk by clicking the "Sound" settings.

Need Help in porting Halo to CM11 /// NullPointerException

Hello
I am working on trying to port halo to cm11 and facing issues.
The Problem:
Its actually giving me nullpointerexception (Heres complete log-> http://pastebin.com/hQ7Wmane ) in BaseStatusBar.java (here's the complete code: http://pastebin.com/bvRaw4ta) in method "mUpdateHalo":
Code:
protected void updateHalo() {
mHaloActive = Settings.System.getInt(mContext.getContentResolver(),
Settings.System.HALO_ACTIVE, 0) == 1;
Resources resources = mContext.getResources();
//I think Next part is where error occurs
if (mHaloActive) {
mHaloButton.setImageDrawable(resources.getDrawable(R.drawable.ic_notify_halo_pressed));
}
else{
mHaloButton.setImageDrawable(resources.getDrawable(R.drawable.ic_notify_halo_normal));}
if (mHaloActive) {
if (mHalo == null) {
LayoutInflater inflater = (LayoutInflater) mContext
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
mHalo = (Halo) inflater.inflate(R.layout.halo_trigger, null);
mHalo.setLayerType(View.LAYER_TYPE_HARDWARE, null);
WindowManager.LayoutParams params = mHalo.getWMParams();
mWindowManager.addView(mHalo, params);
mHalo.setStatusBar(this);
}
} else {
if (mHalo != null) {
mHalo.cleanUp();
mWindowManager.removeView(mHalo);
mHalo = null;
}
}
}
Possible Cause:
As far as I think, its due to the reason that for some reason its not able to find "ic_notify_halo_pressed" and "ic_notify_halo_normal" resources in drawable. I use xhdpi phone (nexus 4), and these resources are present in drawable-xhdpi folder. So maybe I am wrong.....
Additional Info:
I cherry-picked from these repos->
https://github.com/jabzaVR/aospa_pa...mmit/968104f9aa7ecd0efca153a30cc74464bd0956cf
and https://github.com/jabzaVR/aospa_frameworks_base/commit/ab72e4ab36778474593ffce89150aece01d5f9c6
Since the repo is aospa based, I had to manually patch some files (out of which BaseStatuBar.java aka the file where problem occurs is one file that I had to manually patch).
All other things I think work as ROM builds fine and even starts but causes systemui crash with above given log. Would appreciate any help. If you need some other file, please do tell.
EDIT: Solved the Problem.
How's the progress on this?

Kotlin help needed

Hi, I'm now learning Kotlin, and I have seen a lot of time [NUMBER] but I don't know what that means. No result returned after my google search. Example:
Code:
fun main() { HERE
println( decorations.filter {it[0] == 'p'})
}

Categories

Resources