huangcm
2025-04-09 02d4ce54b909bd733f12e9f3fa4c1b03cf2d6f45
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
package com.DeviceTest;
 
import static android.view.WindowManager.LayoutParams.FLAG_FULLSCREEN;
import static android.view.WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON;
 
import com.DeviceTest.helper.ControlButtonUtil;
 
import android.app.Activity;
import android.os.Bundle;
import android.os.Vibrator;
import android.view.KeyEvent;
import android.widget.TextView;
 
public class VibrationTestActivity extends Activity {
 
   private Vibrator mVibrator;
 
   
   protected void onCreate(Bundle paramBundle) {
       super.onCreate(paramBundle);
 
 
       setTitle(getTitle() + "----("
               + getIntent().getStringExtra(DeviceTest.EXTRA_TEST_PROGRESS) + ")");
       //requestWindowFeature(Window.FEATURE_NO_TITLE);
       getWindow().addFlags(FLAG_FULLSCREEN | FLAG_KEEP_SCREEN_ON);
       
       setContentView(R.layout.vibrationtest);
 
       TextView txtTitle = (TextView) findViewById(R.id.txtTitle);
       TextView txtContent = (TextView) findViewById(R.id.txtContent);
       txtTitle.setText(R.string.VibrationTitle);
       txtContent.setText(R.string.VibrationContent);
       this.mVibrator = (Vibrator) getSystemService("vibrator");
       ControlButtonUtil.initControlButtonView(this);
 
   }
 
   protected void onPause() {
       super.onPause();
       this.mVibrator.cancel();
   }
 
   protected void onResume() {
       super.onResume();
       long pattern[] = { 500L, 500L };
       this.mVibrator.vibrate(pattern, 0);
 
   }
 
   public boolean dispatchKeyEvent(KeyEvent event) {
       if (event.getKeyCode() == KeyEvent.KEYCODE_BACK) {
           return false;
       }
       return super.dispatchKeyEvent(event);
   }
}