Android StackBox.java in AOSP - android

I am working on a custom ROM for Android 5.0 and I found out the class StackBox.java in : frameworks/base/services/java/com/android/server/wm/ doesn't exist anymore.
Does anybody know if there is a new class which replaced it?
Thank you in advance

You can use Git to find out when and how a file has been removed or renamed.
$ cd frameworks/base
$ git log -M --name-status --all -- services/java/com/android/server/wm/StackBox.java
For me this yields the following at the top:
commit ed6649f89f236ea9e665028bd33d6d804b906a92
Author: Craig Mautner <cmautner#google.com>
Date: Mon Dec 2 14:08:25 2013 -0800
DO NOT MERGE: Eliminate StackBox.
StackBox is too constraining. Adding size and position to TaskStacks
directly makes stack positioning and management more flexible and
prepares for ActivityView.
Change-Id: I33c6b4e1c23a5a8069fd507c160bcb34e4d287b2
D services/java/com/android/server/wm/StackBox.java
Note the "D" on the last line that tells us that the commit deletes the file in question (if you add the --diff-filter=D option you'll only get commits that deletes the file but then you might lose out on commits that rename the file). Feeding the commit id to git tag --contains tells you in which release this change was introduced:
$ git tag --contains ed6649f89f236ea9e665028bd33d6d804b906a92
android-5.0.0_r1
android-5.0.0_r2
android-5.0.0_r3
android-5.0.0_r4
android-5.0.0_r5
android-5.0.0_r5.1
android-5.0.0_r6
android-5.0.0_r7
android-5.0.1_r1
android-5.0.2_r1
android-wear-5.0.0_r1
I don't know this code well enough to be able to tell you what to use instead but I hope this commit contains what you need.

Related

How do I manually update my custom rom's security patches using 'git cherry-pick'?

I made a custom rom for my device using Resurrection Remix Nougat. However, the security patch of the rom is December 5, 2017. I've found a guide that gives instructions (https://thealaskalinuxuser.wordpress.com/2016/08/29/how-to-manually-update-your-custom-rom-source-code-with-security-updates/) but it says to manually edit the files, even though there are commit codes on the pages (ex: https://android.googlesource.com/platform/frameworks/base/+/4afa0352d6c1046f9e9b67fbf0011bcd751fcbb5)
Is there a way to add these commits using 'git cherry-pick' or something else without manually editing the files?
I have tried the following (with this example: https://android.googlesource.com/platform/frameworks/base/+/4afa0352d6c1046f9e9b67fbf0011bcd751fcbb5)
go to frameworks/base using 'cd frameworks/base'
'git fetch https://android.googlesource.com/platform/frameworks/base'
'git cherry-pick 4afa0352d6c1046f9e9b67fbf0011bcd751fcbb5
After running the chery-pick command, I get this:
fatal: bad object 4afa0352d6c1046f9e9b67fbf0011bcd751fcbb5
Try:
git fetch https://android.googlesource.com/platform/frameworks/base 4afa0352d6c1046f9e9b67fbf0011bcd751fcbb5 --depth 2
git cherry-pick 4afa0352d6c1046f9e9b67fbf0011bcd751fcbb5
And here's another method. Press the button diff on the page of https://android.googlesource.com/platform/frameworks/base/+/4afa0352d6c1046f9e9b67fbf0011bcd751fcbb5, and the diff/patch of the commit is displayed, which starts with the line
diff --git a/core/java/android/net/Uri.java b/core/java/android/net/Uri.java
You can copy and paste the diff into a local file, foo.diff for example, and run
git apply foo.diff
'go to frameworks/base using 'cd frameworks/base'
'git fetch https://android.googlesource.com/platform/frameworks/base' -A
'git cherry-pick 4afa0352d6c1046f9e9b67fbf0011bcd751fcbb5

Git repository suddenly isn't updated anymore even though it commits/pushes ok on Android Studio side

This all worked very smoothly up to now i.e. I have 2 years worth of git updates from this app. Everything looks fine on the AS side i.e. commit/push works fine and it says 'x files commited'. I recently checked my github page directly and to my surprise I didn't see any update for the last 2 months even though I just did 2.
AS shows this i.e. the blue checkmarks show just fine on git, but the 2 red 'x' are not showing: (what is the difference between origin/master vs. master ?)
on the git side I do see this:
when I click on the following button:
it yields a 404 page on git, the blue checkmarks are yielding correct URLs
So something broke and I'm pretty sure I'm the culprit (I had to hack around lots
of files due to very frustrating compile issue. (I spare you those details)
Now, what are my options?
Does anybody know what happened here and what files might be affected and how it can be fixed?
I would prefer not to lose the history etc. of this project and start over on Git, can I somehow 'reconnect' ?
Worst case, if I decide to restart, can I at least not touch anything on the AS side and just start something new on github (do I have to delete the repository or just rename etc.)
Hope I explained this correctly ...
P.S> showing my ignorance on git, barely got this going, so I need to refresh a bit ...
I see a 'branch', but it only shows 'master':
also when I click on the branch icon, it shows this, not sure if that helps, but thanks for the pointer, will check more tomorrow
2nd PS: git status shows:
C:\Users\roberts\AndroidStudioProjects\LingoFlash>git status
On branch master
Your branch is ahead of 'origin/master' by 2 commits.
(use "git push" to publish your local commits)
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified: .idea/caches/build_file_checksums.ser
modified: .idea/misc.xml
Untracked files:
(use "git add <file>..." to include in what will be committed)
.idea/caches/gradle_models.ser
no changes added to commit (use "git add" and/or "git commit -a")
and then this !!!
C:\Users\roberts\AndroidStudioProjects\LingoFlash>git push
fatal: AggregateException encountered.
One or more errors occurred.
Username ---
Password ---
Counting objects: 46, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (37/37), done.
Writing objects: 100% (46/46), 6.21 KiB | 0 bytes/s, done.
Total 46 (delta 30), reused 0 (delta 0)
remote: Resolving deltas: 100% (30/30), completed with 21 local objects.
To https://github.com/---
eb29877..ff09500 master -> master
it seems to have fixed the issue and flushed the 'pipe', thanks so much !
what is the difference between origin/master vs. master ?
origin/master records the last time the remote repository branch master was updated (through push or fetch)
master is a local branch, which does not seem to have been pushed (or origin/master would have been updated to that same commit)
You can try and switch to a command-line session, checking out the output of git status, and git push.

How to copy only the commit messages of Android Studio from log of Version Control

When i block and copy those logs, it will copy the hash, committer, and time too.
For example:
7e15726 hendrawd on 11/13/16 at 10:18 PM Merge remote-tracking branch 'origin/master'
a464db8 hendrawd on 11/13/16 at 10:16 PM fix ignored files
094ef35 Hendra Wijaya Djiono on 11/10/16 at 4:59 PM Swipe refresh will refresh notification count too
4759306 Hendra Wijaya Djiono on 11/10/16 at 12:51 PM Restructure
33ad61b Hendra Wijaya Djiono on 11/10/16 at 12:46 PM Fix force closed when crop picture on create group
8763667 Hendra Wijaya Djiono on 11/9/16 at 7:02 PM Fix duplicate notification
I don't remember when it was implemented, maybe in Android Studio 2.2. It used to be just copy commit messages.
So how i can get only commit messages? Because i just need that instead of the full detail and it is very inconvenience to edit the lines one by one to just get the commit messages.
My Android Studio version is:
Android Studio 2.3
Build #AI-162.3764568, built on February 24, 2017
JRE: 1.8.0_112-release-b06 x86_64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
I don't know what version of idea you use. According to my test on my latest IDEA and WebStorm. I select in log tab of Version Control and copy and paste in Atom, I will get the commit message + name + time.
such as:
test message Xin Meng 31/03/17 11:10
Merge branch 'feature' into develop Xin Meng 31/03/17 10:19
kotlinc Xin Meng 31/03/17 10:19
if the output is above, you can use Atom(or other editor support Regex) to filter the other part.
Such as on Atom:
Ctrl+F and click .* in the Finding panel to enable Regex. And then put Xin Meng.* in the Finding input and replace with blank. Then click the Replace All.
Then all commit messages will be kept and the other things will be replaced with the blank.
Android studio is not support to export the messages directly (no such button or setting). But you can use git command in Terminal window on android studio.
Since there is no setting/button/checkbox to do what i want, the simplest way that i can do without the help of any external software/terminal is just to use regex to detect AM/PM(and a space after it) and replace all the characters before it(inclusive) with empty string directly.
Here are the steps:
Copy the logs
Create a scratch file(Command+Shift+N for Mac)
Paste the logs to the scratch file
Open Replace menu for the scratch file(Command+R for Mac)
Check Regex checkbox
Use this regex on the search box .+?(?=(A|P)M\040)((A|P)M\040)
Hit button Replace all
To be noted, above method is unreliable. If we have commit message that contains string "AM " or "PM ", the previous string will automatically removed too. If IntelliJ decide to change again the copy format of the log, the regex will also be useless. So the best method is to use git command directly with terminal/command prompt
Here is the example:
git log --since="2017-04-09" --pretty=format:"%s"

How do I know the current version in an android repo?

i.e. If I have done:
$ repo init -b froyo; repo sync
and I come back to this repo later, how can I determine which the version checked out is?
In other words, the response to:
$ "unknown command which I am looking for"
should be "froyo" in this case (or the respective version number),
after:
$ repo init -b gingerbread; repo sync
it should be "gingerbread" (or the respective version number)
You can open a manifest.xml file in your .repo hidden directory.
In the file you can find the following tag and value for gingerbread:
default revision="refs/tags/android-2.3.4_r1"
I do not know if it is an official way to do this.
manifests.git
Repo just downloads a given version of a git repository containing manifest files.
That repository is stored inside .repo, so you can check out its version with:
git --git-dir .repo/manifests.git log default
which shows me on the first line:
commit 985cbc6c03245ae454491a062a54afe9e7732d1e (tag: android-7.1.1_r6, origin/android-7.1.1_r6, m/android-7.1.1_r6, default)
Get the SHA of all repos
This command might also be useful, since branches appear to be moving and not sync all the subrepos:
repover() (
# Print the revision of all repos.
top="$(pwd)/"
repo forall -c "pwd=\"\$(pwd)\"; echo \"\$(git log -1 --format=\"%H\") \${pwd#$top}\""
)
The output is of form:
c3e60f38c81a3dd4ff49dca0f05f84a8b464004f art
293d4633af7d80584c7968c650bced857f338bc0 bionic
80ccac2fffc09ef0b8a1fe43c096788e12359a1d bootable/recovery
3aaf722a8d25ed726d4aba5d96bd325afe74a61c build/blueprint
cfcaaa25117310666e02a989a6bd9d45e82d8041 build/kati
a7229a08b7c5d481cb813d810f1d88c3de3cdc8b build/make
2e020842dc44bb67c3aad84217b3e6c4fa8fd900 build/soong
4cc6ccbeeed7d8ddcfb0fc955e523ba6d86e9601 compatibility/cdd
34c43035d43004a23d34b1ae6651f6ea2107eb4c cts
dd452a4244dad07c53db525d314fdcf4429ffd46 dalvik

How do you download a specific release of Android source code (e.g. Android 2.2)

I've never used git before, but I'd like to download the android source code as I'm getting a crash in the 2.2 emulator and I'd like to see exactly where in the android source code it's crashing (so I can file a better bug report).
Edit A decent answer would include instructions on using git to download a specific repository. I'm on windows, but have installed Msysgit.
I'm not entirely sure it's right, but I've done the following (in msysgit):
git clone git://android.git.kernel.org/platform/frameworks/base.git;h=refs/heads/froyo-release
Edit: I now notice that there are two tags - froyo & froyo-release. I'm not sure which one to ues, so I'm downloading them both. Can anyone tell me what the differences are?
Well, as you've found out, the Android code is not stored in only one git repository. Instead they use a python script called repo to coordinate across many repositories. Rabas has the link to Google's instructions.
I've gotten that script to run under Windows using Cygwin. Remember to add the "-b froyo" to the repo init command.
(I don't know the difference between the tags. The repo script obscures most of that; it just deals in branch names.)
Have you checked this page?
When you do repo init, you must specify manifest, and if you want specific branch, after manifest you must add -b eclair for example.
the froyo branch is a working development branch
if you want a stable release get android-2.2.2_r1
You can find out what branches are available using git:
mkdir /tmp/zug
pushd /tmp/zug
git clone https://android.googlesource.com/platform/manifest.git
cd manifest
git branch -a | sed -n '/^ r/s,.*/,,p'|sort -u|column
popd
rm -rf /tmp/zug
Produces something much like this:
android-1.6_r1 android-2.1_r1 android-2.2.3_r2 android-2.3.4_r0.9 froyo
android-1.6_r1.1 android-2.1_r2 android-2.2_r1 android-2.3.4_r1 gingerbread
android-1.6_r1.2 android-2.1_r2.1p android-2.2_r1.1 android-2.3.5_r1 gingerbread-release
android-1.6_r1.3 android-2.1_r2.1p2 android-2.2_r1.2 android-2.3.6_r0.9 ics-mr0
android-1.6_r1.4 android-2.1_r2.1s android-2.2_r1.3 android-2.3.6_r1 master
android-1.6_r1.5 android-2.2.1_r1 android-2.3.1_r1 android-2.3.7_r1 tradefed
android-1.6_r2 android-2.2.1_r2 android-2.3.2_r1 android-2.3_r1
android-2.0.1_r1 android-2.2.2_r1 android-2.3.3_r1 android-4.0.1_r1
android-2.0_r1 android-2.2.3_r1 android-2.3.3_r1.1 android-4.0.1_r1.2

Categories

Resources