Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Elmyra: initial base for the service porting
All right, this is a huge commit - but don't be afraid, we will strip out all the unecessary classes. You are probably wondering "From where did you get the motivation from decompiling, deobfuscating the classes and make them working on AOSP?". Simple, the Pixel 2 / 3 got shipped with a hardware sensor that allows to squeeze the device and trigger some nice actions, I just don't understand why Google wanted to make all these stuff proprietary even though it's something that comes up with the device? Complete non-sense, so I wanted to give this a try and I have managed to get a base working. As a first step I wanted to keep everything clean and I tried to stay away from all the bloat, so here's what I have done: - Decompiled SystemUIGoogle and tried to figure out how this Elmyra service was working. The tools I have used are dex2jar, Jadx (for getting a neat android base to work with) and Procyon for more low-level classes (like Google's protobuf); - My approach it's been to aim to get the service working, so after decompiling the classes I started looking on the proprietary blobs needed for this to work and luckily enough they were just a few; - Completely skipping the OPA and Settings classes helped me A LOT in the tracking process and so here I am with a service that fires up and listens for sensor calls through JNI. Please, keep in mind that these classes are pretty much machine-like as they were decompiled and reworked to properly compile with the Android environment, we need to clean up this base and I am sure we will make it. Last but not least, right now the service is being called through a SystemUI process that calls the GoogleServices class and all the actions available have been commented out and hardcoded with a small Action I wrote based on a simple class that was already there; this class is called Flashlight and allows to trigger the torchlight through our ActionUtils class. Change-Id: Icccbbe6b305851628d214fa1f8df873add3c9670
- Loading branch information
Showing
106 changed files
with
8,249 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<resources> | ||
<!-- Elmyra --> | ||
<integer-array name="elmyra_blocking_system_keys"> | ||
<item>24</item> | ||
<item>25</item> | ||
<item>26</item> | ||
</integer-array> | ||
<integer-array name="elmyra_lower_threshold"> | ||
<item>-450</item> | ||
<item>-650</item> | ||
</integer-array> | ||
<integer-array name="elmyra_slope_sensitivity"> | ||
<item>46</item> | ||
<item>46</item> | ||
</integer-array> | ||
<integer-array name="elmyra_time_window"> | ||
<item>1000</item> | ||
<item>1000</item> | ||
</integer-array> | ||
<integer-array name="elmyra_upper_threshold"> | ||
<item>4000</item> | ||
<item>14000</item> | ||
</integer-array> | ||
|
||
</resources> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<resources> | ||
<!-- Elmyra --> | ||
<item type="id" name="elmyra_feedback_background"/> | ||
<item type="id" name="elmyra_feedback_blue"/> | ||
<item type="id" name="elmyra_feedback_green"/> | ||
<item type="id" name="elmyra_feedback_red"/> | ||
<item type="id" name="elmyra_feedback_view"/> | ||
<item type="id" name="elmyra_feedback_yellow"/> | ||
|
||
</resources> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<resources> | ||
<!-- Elmyra --> | ||
<integer name="elmyra_charging_gate_duration">500</integer> | ||
<integer name="elmyra_false_prime_window">50</integer> | ||
<integer name="elmyra_gesture_cooldown_time">450</integer> | ||
<integer name="elmyra_keyguard_proximity_threshold">5</integer> | ||
<integer name="elmyra_snapshot_gesture_delay_ms">100</integer> | ||
<integer name="elmyra_snapshot_logger_gesture_size">10</integer> | ||
<integer name="elmyra_snapshot_logger_incomplete_gesture_size">10</integer> | ||
<integer name="elmyra_system_key_gate_duration">500</integer> | ||
<integer name="elmyra_usb_gate_duration">500</integer> | ||
|
||
</resources> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -118,4 +118,8 @@ | |
<string name="navigation_bar_height_tablets_landscape_title">Height (landscape)</string> | ||
<string name="navigation_bar_width_title">Width</string> | ||
|
||
<!-- Elmyra --> | ||
<string name="elmyra_raw_sensor_string_type">com.google.sensor.elmyra.raw</string> | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
BoredOutOfMyGit
Member
|
||
<string name="google_camera_app_package_name">com.google.android.GoogleCamera</string> | ||
|
||
</resources> |
53 changes: 53 additions & 0 deletions
53
packages/SystemUI/src/com/google/android/systemui/GoogleServices.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
package com.google.android.systemui; | ||
|
||
import com.android.systemui.Dumpable; | ||
import com.android.systemui.SysUiServiceProvider; | ||
import com.android.systemui.VendorServices; | ||
import com.android.systemui.R; | ||
import com.android.systemui.statusbar.phone.StatusBar; | ||
// import com.google.android.systemui.ambientmusic.AmbientIndicationContainer; | ||
// import com.google.android.systemui.ambientmusic.AmbientIndicationService; | ||
// import com.google.android.systemui.dreamliner.DockObserver; | ||
import com.google.android.systemui.elmyra.ElmyraContext; | ||
import com.google.android.systemui.elmyra.ElmyraService; | ||
import com.google.android.systemui.elmyra.ServiceConfigurationGoogle; | ||
import java.io.FileDescriptor; | ||
import java.io.PrintWriter; | ||
import java.util.ArrayList; | ||
|
||
public class GoogleServices extends VendorServices { | ||
private ArrayList<Object> mServices = new ArrayList(); | ||
|
||
private void addService(Object obj) { | ||
if (obj != null) { | ||
this.mServices.add(obj); | ||
} | ||
} | ||
|
||
public void dump(FileDescriptor fileDescriptor, PrintWriter printWriter, String[] strArr) { | ||
int i = 0; | ||
while (true) { | ||
int i2 = i; | ||
if (i2 < this.mServices.size()) { | ||
if (this.mServices.get(i2) instanceof Dumpable) { | ||
((Dumpable) this.mServices.get(i2)).dump(fileDescriptor, printWriter, strArr); | ||
} | ||
i = i2 + 1; | ||
} else { | ||
return; | ||
} | ||
} | ||
} | ||
|
||
public void start() { | ||
StatusBar statusBar = (StatusBar) SysUiServiceProvider.getComponent(this.mContext, StatusBar.class); | ||
// AmbientIndicationContainer ambientIndicationContainer = (AmbientIndicationContainer) statusBar.getStatusBarWindow().findViewById(R.id.ambient_indication_container); | ||
// ambientIndicationContainer.initializeView(statusBar); | ||
// addService(new AmbientIndicationService(this.mContext, ambientIndicationContainer)); | ||
// addService(new DisplayCutoutEmulationAdapter(this.mContext)); | ||
// addService(new DockObserver(this.mContext)); | ||
if (new ElmyraContext(this.mContext).isAvailable()) { | ||
addService(new ElmyraService(this.mContext, new ServiceConfigurationGoogle(this.mContext))); | ||
} | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
packages/SystemUI/src/com/google/android/systemui/elmyra/ElmyraContext.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package com.google.android.systemui.elmyra; | ||
|
||
import android.content.Context; | ||
|
||
public final class ElmyraContext { | ||
private Context mContext; | ||
|
||
public ElmyraContext(Context context) { | ||
this.mContext = context; | ||
} | ||
|
||
public boolean isAvailable() { | ||
return this.mContext.getPackageManager().hasSystemFeature("android.hardware.sensor.assist"); | ||
} | ||
} |
Oops, something went wrong.
Pretty sure you want translatable=false on these?