Skip to content

Commit 5f839f8

Browse files
committed
Fix obsolete Honeycomb platlogo.
Bug: 5438131 Change-Id: I848bcc8e4d6cdd28c1ffaa08b7fcceb87242932a
1 parent 3487787 commit 5f839f8

File tree

24 files changed

+387
-13
lines changed

24 files changed

+387
-13
lines changed

core/java/com/android/internal/app/PlatLogoActivity.java

Lines changed: 60 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,32 +17,79 @@
1717
package com.android.internal.app;
1818

1919
import android.app.Activity;
20+
import android.content.ActivityNotFoundException;
21+
import android.content.Intent;
2022
import android.os.Bundle;
23+
import android.os.Handler;
24+
import android.os.Vibrator;
2125
import android.view.MotionEvent;
26+
import android.view.View;
27+
import android.view.ViewConfiguration;
2228
import android.widget.ImageView;
2329
import android.widget.Toast;
2430

2531
public class PlatLogoActivity extends Activity {
2632
Toast mToast;
33+
ImageView mContent;
34+
Vibrator mZzz = new Vibrator();
35+
int mCount;
36+
final Handler mHandler = new Handler();
37+
38+
Runnable mSuperLongPress = new Runnable() {
39+
public void run() {
40+
mCount++;
41+
mZzz.vibrate(50 * mCount);
42+
final float scale = 1f + 0.25f * mCount * mCount;
43+
mContent.setScaleX(scale);
44+
mContent.setScaleY(scale);
45+
46+
if (mCount <= 3) {
47+
mHandler.postDelayed(mSuperLongPress, ViewConfiguration.getLongPressTimeout());
48+
} else {
49+
try {
50+
startActivity(new Intent(Intent.ACTION_MAIN)
51+
.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK
52+
| Intent.FLAG_ACTIVITY_CLEAR_TASK
53+
| Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS)
54+
.setClassName("com.android.systemui","com.android.systemui.Nyandroid"));
55+
} catch (ActivityNotFoundException ex) {
56+
android.util.Log.e("PlatLogoActivity", "Couldn't find platlogo screensaver.");
57+
}
58+
finish();
59+
}
60+
}
61+
};
2762

2863
@Override
2964
protected void onCreate(Bundle savedInstanceState) {
3065
super.onCreate(savedInstanceState);
3166

32-
mToast = Toast.makeText(this, "REZZZZZZZ...", Toast.LENGTH_SHORT);
67+
mToast = Toast.makeText(this, "Android 4.0: Ice Cream Sandwich", Toast.LENGTH_SHORT);
3368

34-
ImageView content = new ImageView(this);
35-
content.setImageResource(com.android.internal.R.drawable.platlogo);
36-
content.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
37-
38-
setContentView(content);
39-
}
69+
mContent = new ImageView(this);
70+
mContent.setImageResource(com.android.internal.R.drawable.platlogo);
71+
mContent.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
4072

41-
@Override
42-
public boolean dispatchTouchEvent(MotionEvent ev) {
43-
if (ev.getAction() == MotionEvent.ACTION_UP) {
44-
mToast.show();
45-
}
46-
return super.dispatchTouchEvent(ev);
73+
mContent.setOnTouchListener(new View.OnTouchListener() {
74+
@Override
75+
public boolean onTouch(View v, MotionEvent event) {
76+
final int action = event.getAction();
77+
if (action == MotionEvent.ACTION_DOWN) {
78+
mContent.setPressed(true);
79+
mHandler.removeCallbacks(mSuperLongPress);
80+
mCount = 0;
81+
mHandler.postDelayed(mSuperLongPress, 2*ViewConfiguration.getLongPressTimeout());
82+
} else if (action == MotionEvent.ACTION_UP) {
83+
if (mContent.isPressed()) {
84+
mContent.setPressed(false);
85+
mHandler.removeCallbacks(mSuperLongPress);
86+
mToast.show();
87+
}
88+
}
89+
return true;
90+
}
91+
});
92+
93+
setContentView(mContent);
4794
}
4895
}
-43.7 KB
Loading

packages/SystemUI/AndroidManifest.xml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,5 +101,21 @@
101101
android:taskAffinity="com.android.systemui.net"
102102
android:excludeFromRecents="true" />
103103

104+
<!-- started from ... somewhere -->
105+
<activity
106+
android:name=".Nyandroid"
107+
android:exported="true"
108+
android:label="Nyandroid"
109+
android:icon="@drawable/nyandroid04"
110+
android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen"
111+
android:hardwareAccelerated="true"
112+
android:launchMode="singleInstance"
113+
android:excludeFromRecents="true">
114+
<intent-filter>
115+
<action android:name="android.intent.action.MAIN" />
116+
<category android:name="android.intent.category.DEFAULT" />
117+
<category android:name="android.intent.category.DREAM" />
118+
</intent-filter>
119+
</activity>
104120
</application>
105121
</manifest>
622 Bytes
Loading
574 Bytes
Loading
615 Bytes
Loading
574 Bytes
Loading
576 Bytes
Loading
568 Bytes
Loading
614 Bytes
Loading

0 commit comments

Comments
 (0)