yashsingh1/xdaforums huggingface dataset:
[Android Software Development] Lanchon:
> For the moment I just assigned it (if null) in the method before it's used.

this fails if your method is called in a threaded manner, because what was a read field operation (inherently thread safe) becomes a potentially modifying operation. this is not the best way to solve this.

> 1) Regarding the initialization, I don't understand the examples and docs in Main.java for this.

there are no initializers for instance fields in bytecode. what javac does is: it generates code that initializes all instance fields, and places a copy of such code at the beginning of every constructor of the class (that does not invoke another constructor via 'this(...)').

> How does one initialize their variables if the target class (a) has no explicit constructor or (b) append the class's existing constructor (if possible)?

all classes typically have a constructor in bytecode. if you dont define any in java text, javac generates a default (ie: no argument) constructor that first calls 'super();' and then initializes all instance variables defined in this class that need initialization (but not those of super and up the chain). default initialization of fields (zero, false, null) is done by the JVM and does not require any bytecode.

my recommendation for initialization of added fields:

- try to rely on default initialization.

- if custom initialization is needed:

--- DO NOT use the '= value' syntax at the declaration point.

--- DO extend the existing constructor(s) and add explicit init code to those:

[MENTION=232767]dex[/MENTION]Edit
private X [MENTION=916460]dexi[/MENTION]gnore Void tag) { throw null; }
[MENTION=232767]dex[/MENTION]Add
public X() {
// Because this constructor invokes another via 'this()', it will
// not initialize any instance fields. The fields are assumed to
// be initialized by the invoked constructor. In this case, the
// invoked constructor will initialize all source instance fields.
this((Void) null);
// ADD your initialization code for added fields HERE
}

> 2) This class PhoneWindowManager class i'm patching implements WindowManagerPolicy which is hidden in the Android API so obviously I can't match the exact signature. I got around that by using contentOnly = true which works fine but I am concerned about the disclaimer you gave - "this has complex implications affecting the type system and the constructors of the class. It is generally not recommended". Sounds scary.

don't be scared... :) this can cause issues if you are patching a graph of classes related by inheritance; not the case.

> So I should try to always avoid this?

no.

> Could it be avoided by making dummy/skeleton classes (e.g. an empty WindowManagerPolicy class matching the same package as the original) but then using @ DexIgnore on the class?

yes! but no need whatsoever to this in your case.

> Also, lol with the @ Dex stuff triggering XDA forum mention feature for random users.

very lol, poor guys :)
[Android Software Development] Lanchon:
on the plugin issue...

> Based on the patch-lib sample, I started work on a mod for framework.jar. I had to convert it into a dummy APK file by adding a dummy manifest and string XML. Would you consider making a plugin named "com.github.lanchon.dexpatcher.jar-library" to make this more graceful?

dxp-gradle is more than dxp-tool. the tool patches dex bytecode, but the gradle plugins do more: they can mod/augment code (via dxp-tool), android resources, the manifest, java resources, etc. the plugins are thus fairly complex, and are geared towards patching APKs, which potentially encapsulate all these things.

if you want to patch code only, you should not use the plugins at all, IMHO.

many plugins could be implemented:

-- a plugin that rebuilds the app with apktool instead of the android gradle system:

---- it is java (not android) and would run in vanilla intelliJ IDEA.

---- not split into 2 projects. (no apk library file needed.)

---- if necessary, resources are modded by touching apktool decode files directly.

---- does not use the android gradle plugins, do does not need a local android SDK, but....

---- requires the android symbols to compile the patch against. (taken from SDK?)

---- requires the dx executable. (added to dexpatcher-gradle-tools or taken from SDK?)

---- requires signing of the resulting APK. (same as previous.)

---- what version of dx? (for dex version 035, 037 or 038?) some dx exes require java 8, some don't.

---- where does the signature data come from?

-- a plugin that rebuilds the app with zip/jar instead of the android gradle system:

---- cannot modify anything besides the code itself.

---- other than that, same issues as before.

-- a plugin that patches just code (dex, jar, zip, apk):

---- might just output the dex file(s).

---- or might zip back into a jar/zip/apk, becoming the previous plugin.

---- might support optional signing (for apks).

i have too many things more pressing than implementing any of this (and id start with the apktool build thing i guess anyway).

patching random dex code (such as framework.jar) is just too custom for me to do plugins at this time. however...

1) to do what you are doing (if you insist on using the plugins) i'd use the simpler patched-app sample with 2 sub projects instead of 3. in the 'patched' subproject, under build/ you WILL find the patched dex somewhere. look for it. you dont need to extract any classes and run dx on them this way. (btw, the same applies to the 'patch-lib' sample under subproject 'patched': you'll find the dex there.)

2) you can use the dexpatcher base plugins which includes tasks for apktool, dexpatcher and dex2jar but does not come with a predefined task structure. using base it's easy to build your own patch flow. i COULD add an example for you, building and ad-hoc gradle script atop base plugin to patch, say, framework. i guess that would be useful for people with special needs to hack on.

3) i published a project called haystack that patches the framework. it's shell-based (not gradle) and very specific for its purpose. also quite complex. but you could take a look at it.
[Android Software Development] Lanchon:
hi!

> fatal: exception: lanchon.multidexlib2.MultiDexDetectedException: C:\Users\Klaus\Desktop\dexpatcher\dexpatcher-gradle-samples-master\patched-app\patched\build\intermediates\exploded-aar\patched-app\source\unspecified\dexpatcher\dex

this directory:

C:\Users\Klaus\Desktop\dexpatcher\dexpatcher-gradle-samples-master\patched-app\patched\build\intermediates\exploded-aar\patched-app\source\unspecified\dexpatcher\dex

has a multidex and multidex is not enabled in your build script. hence the error.

but you are building patched-app sample!

that dir is 'exploded-aar', where the apk library built in subproject 'source' is expanded to.

the 'source' is not a multidex app, so this shouldnt be happening!

how did you modify the sample? what do you want to do?

thanks
[Android Software Development] CosmicDan:
Awesome, thanks for the detailed info!

With volatiles though, can I ask for a reference for that info? I did a lot of research on this and I used to use synchronized much more often, but everywhere I read said that monitors are more heavyweight and only useful when you want more than one instruction (e.g. i++) to be thread safe and guarantee sequential operation - yet a volatile is faster since they are just a write-through variable and nothing else. In other words, a synchronized block is slower because it's akin to making every read/write operation on everything inside it a volatile/atomic one, which is often not necessary.

I can't find any info that discourages volatile for performance reasons at all, but rather that the volatile store operations can be up to one third faster than monitor enter/exit on cache-coherent CPU's (which x86_64 and ARMv8-A both are).
[Android Software Development] Lanchon:
> monitors are more heavyweight

wrong! as i said before:

> reading/writing a volatile post java 5 is exactly as heavy as entering/exiting a monitor (has acquire/release semantics).

this means that i++ which is a read-mod-write is exactly as heavy OR HEAVIER as BOTH entering then exiting a monitor (except monitors are near-zero cost if already held).

> and only useful when you want more than one instruction (e.g. i++)

out of the back of my head, i cant refute nor affirm that i++ for i volatile is atomic. IT MIGHT NOT BE. or it might depend on type (int vs long).

> yet a volatile is faster since they are just a write-through variable and nothing else.

they are not faster and volatile access is nothing like what you describe; read the fixed spec (java 5 and later).

> In other words, a synchronized block is slower because it's akin to making every read/write operation on everything inside it a volatile/atomic one, which is often not necessary.

ABSOLUTELY FALSE. monitor enter is partial acquire and volatile read is FULL acquire (potentially slower, but usually not in real life. but CANT be faster). same situation for monitor exit and volatile write, they have release semantics (full for volatile). all operations inside a monitor are absolutely normal operations.

> With volatiles though, can I ask for a reference for that info?

the java memory model, as fixed and rewritten by doug lea, bill pugh, etc. it is part of the java lang spec for java 5 and later.

> I can't find any info that discourages volatile for performance reasons at all, but rather that the volatile store operations can be up to one third faster than monitor enter/exit on cache-coherent CPU's (which x86_64 and ARMv8-A both are).

look better. a volatile write is not very useful without a read. in any case, you shouldnt care about performance, you should care about CORRECTNESS. concurrency is HARD. volatiles are MUCH HARDER. for proof i offer: you are using volatiles and you don't know what they are (like 99% of developers). that said, volatiles have some very minor uses, for people like doug lea, etc who write concurrency libraries (and define what the VMs must do, and what the language means). DONT USE VOLATILES EVER. average programmers are not smart enough all the time to make correct usage of them, AND THERE IS NO REASON TO MESS WITH THEM.

as a corollary to this i say: either 1) the code you've been writing with volatiles is incorrect, or 2) it is slower than a more naive monitor implementation, or 3) both. better to rewrite it all using monitors.

but anyway, this thread is hardly the place to discuss this.
[Android Software Development] Lanchon:
some time after the release of java 4 something notable happened, smart people started to realize stuff about the platform:

- the memory model of the java lang spec was incorrect and mostly meaningless. no one ever understood it, not even their creators, and definitely not any of the JVM authors.

- no JVM was compliant with the spec.

- common idioms used in java coding were incorrect.

- good java programmers were writing incorrect code due to misunderstanding of the memory model.

- even the complete java class library in Sun's JDK had to be rewritten because threading was all wrong.

the reality of memory models is much more complex than the regular programmer even remotely suspects, and when they "take charge", they write broken code. DONT TAKE CHARGE, EVER.

this is a summary of the discussions that arose before java 5, and that triggered these discoveries and the fixing and rewriting of the meaning of the java platform. this is pre-java 5, from bill pugh's site:

https://www.cs.umd.edu/~pugh/java/memoryModel/DoubleCheckedLocking.html

read it fully, but take special note on the section "Under the new Java Memory Model --- Fixing Double-Checked Locking using Volatile". this is the key insight of why volatile accesses were "promoted" to full acquire/release semantics, making them as heavyweight as monitors: to retroactively fix a lot of broken code already out there in the wild. before java 5, volatiles were so "soft" that they had virtually no correct usage whatsoever.
[Android Software Development] CosmicDan:
Thanks heaps for the info. A bit of it is over my head but I'm inclined to believe you know what you're talking about :D

Yeah, off topic. Will send a PM, just to follow up on this.

---------- Post added at 07:11 PM ---------- Previous post was at 06:39 PM ----------

Oh, sorry, just to repeat the other two forgotten issues I mentioned when I made my patch based on the patch-lib sample (minor though):

1) When I build the patch I get an aar, so I take the jar out of that and convert it to a dex manually. I thought there would be a gradle task to only make a dex, or was that only in the old pre-gradle system?

2) What exactly is the "source" apk for? Is it required for building to include stuff, is it just for code verification, or only a reference? Would it be possible for you to add a "com.github.lanchon.dexpatcher.jar-library" plugin someday to save the need for converting jar files into dummy apk's?
[Android Software Development] Lanchon:
hi,

the source apk is the apk you are patching.

i've answered those questions here:

https://xdaforums.com/android/software/tool-dexpatcher-modify-android-dex-apk-t3060854/post74210858
[Android Software Development] CosmicDan:
Oh I missed that, sorry.

So basically, I should be using dxp-tool instead of the gradle plugin since I am only interested in patching dex files? OK, I'll check that out (I'm assuming the deprecated scripts will help me do that). Cheers.

I can't figure out how to use IDEA without doing a fake source APK though, but meh - that's unsupported so I'll make do. Figured it all out, as you probably said I can just import the patch as a regular Android project. All sorted :)
[Android Software Development] esun:
I'm getting "Error:type '***.MainActivity$1': (MainActivity.java:0): already exists" and I'm not sure how to proceed. I've looked over the github source and our previous interaction and it feels like I'm missing something.

I'm editing the MainAcitivity class with [MENTION=4683450]Dexed[/MENTION]it and wrapping two of it's instance methods.

Edit: Alright! I missed one of my OnClickListeners which I guess created the class MainActivity$1 since smali doesn't really have anonymous classes.
[Android Software Development] Lanchon:
i'm not planing to create a plugin for now, but i am working on a sample for you. hold on for it...
[Android Software Development] Lanchon:
that's correct, always define named nested classes instead of anonymous classes in patch code.
[Galaxy Note 3 Q&A, Help & Troubleshooting] JazonX:
Guys,

Why does the below happen ?

Drains my battery within a few hours..
[Galaxy Note 3 Q&A, Help & Troubleshooting] JazonX:
Saw That already. Didnt seem to solve anything, and I didnt have any PDF Files.

Removed Galaxy Finder APK , Lets hope for the best!

Thanks a lot Mate !
[Galaxy Note 3 Q&A, Help & Troubleshooting] 1Ishara:
I had same problem i removed index apk and finder apk everything was fine after that. But after i shifted to lolipop i never remove those two files.. Usually im getting 5 hr screen on time and 24hr use.. :)
[Galaxy Note 3 Q&A, Help & Troubleshooting] JazonX:
Thanks Machan.. Index APK also removed.
[Galaxy Note 3 Q&A, Help & Troubleshooting] 1Ishara:
Welcome bro.. I thought its really hard to find sri lankan in xda

. :D
[Verizon Galaxy Note 3 Q&A, Help & Troubleshooting] orateam:
I noticed i've been throttled. after 2.5gigs, i rarely get faster than 1mgps. I'm currently unlimited grandfathered. Used to use between 8 and 13 gigs a month and because of the throttling the last few months, averaged about 2.7 to 3.3. So switching to cricket ($55 for 20gigs a month).

My question is since cricket runs on att, can i just flash an ATT ROM? I think i can just change apn settings on a verizon ROM, but wanted to know if i could flash an ATT rom?

Thanks
[Verizon Galaxy Note 3 Q&A, Help & Troubleshooting] orateam:
thanks. For my curiosity, can you summarize why not. I just tested simply changing the apn settings on verizon rom and that worked.
[Verizon Galaxy Note 3 Q&A, Help & Troubleshooting] Chocu1a:
You cannot flash an ATT rom. You can just pop a Cricket sim in your phone as is. Just add the apn & it will work. You will only get hspa+, but honestly, that is fast enough & coverage is great.
[Verizon Galaxy Note 3 Q&A, Help & Troubleshooting] orateam:
process completed. I really like it. Was able to drive from orlando to tampa streaming 2gbs of music. Never hiccuped once. I have the 20gb plan for $55 taxes included so the data was a drop in the bucket. :)
[Verizon Galaxy Note 3 Q&A, Help & Troubleshooting] Chocu1a:
What speeds are you getting
[Sprint Samsung Galaxy S III] 2Beastmode4u:
Hello,

So currently my MEID is all zeros according to DFS. My ESN is B0000000 in DFS as well. In my phone settings it shows that my phone number is 000-000-0016. Also shows a different MEID in my settings: 17600000000

When I trry to change my MEID/ESN number in DFS I get the error:

"CPS_ERROR BAD_SPC_MODE"

How do I fix this. I alrady know that my SPC is 222222 and it says device unlocked in the logs.
[G 2014 Q&A, Help & Troubleshooting] MatHunter:
Anyone know if is posible to use the Moto G xt1069 to watch de TV in Mexico(atsc)? I known we have a diferent way to watch digital tv than in Brazil (isbd-t), i just wondering... Moto G retail Brazil---:confused:
[G 2014 Q&A, Help & Troubleshooting] TheReal V:
Do you already tried to watch ? maybe DTV won't work, but analog signal will
[G 2014 Q&A, Help & Troubleshooting] prathameshsd:
DTV is region specific. XT1069 will only work in Brazil where DTV is supported. You cant use it in Mexico. Try other Live TV Apps from Playstore to stream TV via WiFi
[Galaxy S 4 Q&A, Help & Troubleshooting] Keva161:
Hi all,

I recently tried to use the app 'Flashify' to upgrade my installed version of Clockwork Mod to the latest version.

Now whenever I try to boot my phone, it goes straight into recovery mode in which my phone freezes with the 'Recovery Booting...' message displayed on-screen.

I was able to put the phone into download mode and have been able to boot back into the Android OS by using Heimdall on my Mac (I don't have access to a Windows machine) and flashing the stock boot.img to the BOOT partition.

Even when I try to boot into the recovery mode (By pressing the HOME + Volume Up + Power buttons] it still freezes.

I would like to try out custom roms however, so how can I get the recovery function on my phone working again?
[Galaxy S 4 Q&A, Help & Troubleshooting] Lennyz1988:
If you know how to use Heimdall, then flash again the recovery with it.

Use this command:

heimdall flash --recovery recovery.img --no-reboot

I never like those apps like Flashify, because when you do it manually, you know what you are doing.
[Galaxy S 4 Q&A, Help & Troubleshooting] Keva161:
Awesome! Thank you!

I am getting a couple of error messages though 'E: failed to mount /efs (Invalid arguments').
[8525, TyTN, MDA Vario II, JasJam Software Upgradin] soregg:
I could like to invite someone to do me a favour please.

I want to import the "keyboard" to my non-english WM5 but I don't know how to do it. May someone teach me how to do it please?
[8525, TyTN, MDA Vario II, JasJam Software Upgradin] Abo Forat:
non-english keyboard layout

Its easy..keyboard layout files are usually CAB files. U can copy them 2 your device and just fire it. Witch language u wont to install?
[Sony Cross-Device Development Themes and Apps] -XperiaMan-:
Hey guys ! :) Today I will share the wallpapers of Sony's Lollipop with you :) . I got my hands on the Blue wallpaper and edited it to make more colours ! :D . Feel free to use them to your Themes ! ;)

ChangeLog :

- 21/3 : Initial release

- 22/3 : Pack 2 with more colors :cool:

DOWNLOADS

- Mediafire

Pack 1 http://www.mediafire.com/download/dqni9ibk1bpzggz/XperiaLollipop+Wallpapers.zip

Pack 2

http://www.mediafire.com/download/9rif8sy3vyb12wv/XperiaLollipopWallpapers2.zip

- Dev Host

Pack 1 XperiaLollipop Wallpapers.zip - 11.18 MB

Pack 2 XperiaLollipopWallpapers2.zip - 10.86 MB
[Sony Cross-Device Development Themes and Apps] a.hamameh96:
Nice work mate thanks for your hard work ;)

But I have a question is it based on the blue wall that I have share? :confused:

Also I have a suggestion

Can you make more wallpaper with a similar colors of the Xperia Style cover themes and one with white?

With my regards.

a.hamameh
[Sony Cross-Device Development Themes and Apps] -XperiaMan-:
It's not based on your wallpaper , believe me ;) .

Ok , I'm working on more colours ;) Stay tuned :cool:
[Sony Cross-Device Development Themes and Apps] a.hamameh96:
I will believe you of course ;)

Thanks for your hard work and I will wait the new one :fingers-crossed:

KEEP IT UP :good:
[Sony Cross-Device Development Themes and Apps] -XperiaMan-:
Surprise ! :D New wallpaper pack is online :cool:
[Sony Cross-Device Development Themes and Apps] a.hamameh96:
Awesome :good: :good:

Nice work mate ;)
[Sony Cross-Device Development Themes and Apps] capobilo:
Hey can you also make different colors of the new wallpapers from style cover themes? It looks a little bit different than the standard ones.
[Sony Cross-Device Development Themes and Apps] -XperiaMan-:
Maybe I'll do some ;) . But first I will finish the projects I'm working on :)
[Sony Cross-Device Development Themes and Apps] Shahroz Ahmed:
Great work
[Honor 6, 6 Plus Q&A, Help & Troubleshooting] amintehrani:
Hi I am using the program vier4android

Unfortunately, does not work with original Music Player[emoji17]

But it works the poweramp music player[emoji29]

Is there a way that the work with original music player [emoji5]

Please help me

Thank you[emoji257]
[Honor 6, 6 Plus Q&A, Help & Troubleshooting] windkzx:
I think the V4A has the strong mode and compatible. Do you try this? I have deleted the original music player so I cannot try it....
[Galaxy Note 3 Q&A, Help & Troubleshooting] ryanjmchale:
Hello,

Could someone running TW stock rom on lollipop Bob6 please host the default Bootanimation file as my backup is missing, the phone no longer boots, it would save me from a nandroid restore. Thanks in advance.

stock bootanimation file from system/bin

Regards

Ryan M
[Android Apps and Games] kalabazan:
[IMG="Main Icon"]https://lh6.ggpht.com/sGc7t1Eule-r7XwuWACUetjz3ft9hRw5pPbmpgRvUSJlUeTO68055YjlgDkrvYrRMA=w300[/IMG]

https://play.google.com/store/apps/details?id=com.kalabazan.DoomJump

It`s my first released game for Android so don`t by hypercritical plz. Develop of this game took about a one week for me, and I know that it don`t pretend for any revards, created for fun:)

Description of it:

New game that help you to pass the time with pleasure.

Test your reaction and patience that would unlock all the achievements and overtop your friends. Challenge players around the world and prove that you're the coolest.

That's why you should try it:

- achievements to unlock

- challenge your friends

- challenge players around the world

- easy and funny gameplay

- totally free

P.S. It`s may be very tricky to go on the top of the leaderboard, but you should try harder ;)

Some screenshots:

[IMG="screen1"]https://lh5.ggpht.com/T2JuOwafpxdyFN9eETaNlXCPfoq_UccBoOxzPH1Gm_iT7MeDBOTVVfyH6MYfSMWUhXW6=h310[/IMG]

[IMG="screen2"]https://lh6.ggpht.com/O3dJKX5WdjIOzCHBsJqyPGwi6aQEgTrcYkPbxDoSqE5flddlk0bF8GKg92C3g18Ccro=h310[/IMG]

[IMG="screen3"]https://lh4.ggpht.com/jwGUd6E5_vEGgxFrqpoMgOXUgzttG4D0ByWrU_s1V73sTR_NwrLyniXNRBCYxjOmf5E=h310[/IMG]
[Android Q&A, Help & Troubleshooting] AlienTechGR:
Hi,why it disappeared from Play Store??Where can I find the latest free version??
[Android Q&A, Help & Troubleshooting] AlienTechGR:
Anyone??