Bug 1200513 - Route http(s) url to gaia r=snorp

This commit is contained in:
Fabrice Desré 2015-09-04 14:06:44 -07:00
parent 75a47d51a5
commit 486eb86701
4 changed files with 17 additions and 3 deletions

View File

@ -60,7 +60,10 @@
<activity android:name="org.mozilla.b2gdroid.Launcher"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
android:icon="@drawable/b2g"
android:label="@string/b2g">
android:label="@string/b2g"
android:launchMode="singleInstance"
android:clearTaskOnLaunch="true"
android:stateNotNeeded="true">
<!-- Set up as a homescreen replacement -->
<intent-filter>

View File

@ -116,6 +116,7 @@ public class Launcher extends Activity
Log.w(LOGTAG, "onDestroy");
super.onDestroy();
IntentHelper.destroy();
mScreenStateObserver.destroy(this);
mScreenStateObserver = null;
EventDispatcher.getInstance().unregisterGeckoThreadListener(this,
@ -125,7 +126,7 @@ public class Launcher extends Activity
}
@Override
protected void onNewIntent (Intent intent) {
protected void onNewIntent(Intent intent) {
final String action = intent.getAction();
Log.w(LOGTAG, "onNewIntent " + action);
if (Intent.ACTION_VIEW.equals(action)) {

View File

@ -28,6 +28,11 @@ class ScreenStateObserver extends BroadcastReceiver {
context.registerReceiver(this, filter);
}
void destroy(Context context) {
Log.d(LOGTAG, "ScreenStateObserver::unint");
context.unregisterReceiver(this);
}
@Override
public void onReceive(Context context, Intent intent) {
Log.d(LOGTAG, "ScreenStateObserver: " + intent.getAction());

View File

@ -34,15 +34,20 @@ this.MessagesBridge = {
let data = JSON.parse(aData);
debug(`Got Android:Launcher message ${data.action}`);
let window = SystemAppProxy.getFrame().contentWindow;
switch (data.action) {
case "screen_on":
case "screen_off":
// In both cases, make it look like pressing the power button
// by dispatching keydown & keyup on the system app window.
let window = SystemAppProxy.getFrame().contentWindow;
window.dispatchEvent(new window.KeyboardEvent("keydown", { key: "Power" }));
window.dispatchEvent(new window.KeyboardEvent("keyup", { key: "Power" }));
break;
case "view":
let a = new window.MozActivity({ name: "view",
data: { type: "url",
url: data.url } });
break;
}
}
}